CF_INLINE __CFICUThreadData *__CFStringEncodingICUGetThreadData() { __CFICUThreadData * data; data = (__CFICUThreadData *)_CFGetTSD(__CFTSDKeyICUConverter); if (NULL == data) { data = (__CFICUThreadData *)CFAllocatorAllocate(NULL, sizeof(__CFICUThreadData), 0); memset(data, 0, sizeof(__CFICUThreadData)); _CFSetTSD(__CFTSDKeyICUConverter, (void *)data, __CFICUThreadDataDestructor); } return data; }
void CFAllocatorSetDefault(CFAllocatorRef allocator) { CFAllocatorRef current = __CFGetDefaultAllocator(); #if defined(DEBUG) if (NULL != allocator) { __CFGenericValidateType(allocator, _kCFRuntimeIDCFAllocator); } #endif #if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED || DEPLOYMENT_TARGET_EMBEDDED_MINI if (allocator && allocator->_base._cfisa != __CFISAForCFAllocator()) { // malloc_zone_t * return; // require allocator to this function to be an allocator } #endif if (NULL != allocator && allocator != current) { if (current) CFRelease(current); CFRetain(allocator); // We retain an extra time so that anything set as the default // allocator never goes away. CFRetain(allocator); _CFSetTSD(__CFTSDKeyAllocator, (void *)allocator, NULL); } }