CF_PRIVATE CFArrayCallBacks *__CFArrayGetCallBacks(CFArrayRef array) { CFArrayCallBacks *result = NULL; switch (__CFRuntimeGetValue(array, 3, 2)) { case __kCFArrayHasNullCallBacks: return (CFArrayCallBacks *)&__kCFNullArrayCallBacks; case __kCFArrayHasCFTypeCallBacks: return (CFArrayCallBacks *)&kCFTypeArrayCallBacks; case __kCFArrayHasCustomCallBacks: break; } switch (__CFArrayGetType(array)) { case __kCFArrayImmutable: result = (CFArrayCallBacks *)((uint8_t *)array + sizeof(struct __CFArray)); break; case __kCFArrayDeque: result = (CFArrayCallBacks *)((uint8_t *)array + sizeof(struct __CFArray)); break; } return result; }
CF_INLINE UInt32 __CFBinaryHeapMutableVariety(const void *cf) { return __CFRuntimeGetValue(cf, 3, 2); }
/* Only applies to immutable and mutable-deque-using arrays; * Returns the bucket holding the left-most real value in the latter case. */ CF_INLINE struct __CFArrayBucket *__CFArrayGetBucketsPtr(CFArrayRef array) { switch (__CFArrayGetType(array)) { case __kCFArrayImmutable: return (struct __CFArrayBucket *)((uint8_t *)array + __CFArrayGetSizeOfType(__CFRuntimeGetValue(array, 6, 0))); case __kCFArrayDeque: { struct __CFArrayDeque *deque = (struct __CFArrayDeque *)array->_store; return (struct __CFArrayBucket *)((uint8_t *)deque + sizeof(struct __CFArrayDeque) + deque->_leftIdx * sizeof(struct __CFArrayBucket)); } } return NULL; }
CF_INLINE CFIndex __CFArrayGetType(CFArrayRef array) { return __CFRuntimeGetValue(array, 1, 0); }