#include <malloc.h>

typedef struct {
    int ref_count;
} data;

#define foo_ref(x) (void*)data_ref((data*)x)

data*
data_new (void)
{
    data *ret;
    
    ret = malloc(sizeof(data));
    ret->ref_count = 1;

    return ret;    
}

data*
data_ref (data *d)
{
    d->ref_count++;
    return d;
}

int
main(int argc, char *argv[])
{
    data *d;
    
    d = data_new();
    foo_ref (d);

    return 0;
}
