Is there a constant retain callback I can use for generic id
/ NSObject
s ? There is kCFTypeDictionaryValueCallBacks
but they're only for "CFType-derived objects." I don't believe NSObjects are CFTypes, so I wrote these:
const void *valueRetainCallBack(CFAllocatorRef allocator, const void *ptr)
{
id o = (id)ptr;
[o retain];
return o;
}
void valueReleaseCallBack(CFAllocatorRef allocator, const void *ptr)
{
id o = (id)ptr;
[o release];
}
But perhaps there is a simpler way?