CFMutableSetRef CFSetCreateMutableCopy (CFAllocatorRef allocator, CFIndex capacity, CFSetRef set) { if (CF_IS_OBJC (_kCFSetTypeID, set)) { CFMutableSetRef result; const CFIndex count = CFSetGetCount (set); void **values = (void **) CFAllocatorAllocate (allocator, sizeof (void *) * count, 0); CFIndex i; CFSetGetValues (set, (const void **) values); result = CFSetCreateMutable (allocator, count, &kCFTypeSetCallBacks); for (i = 0; i < count; i++) GSHashTableAddValue ((GSHashTableRef) result, values[i], values[i]); CFAllocatorDeallocate (allocator, (void *) values); return result; } return (CFMutableSetRef) GSHashTableCreateMutableCopy (allocator, (GSHashTableRef) set, capacity); }
CFMutableBagRef CFBagCreateMutableCopy (CFAllocatorRef allocator, CFIndex capacity, CFBagRef bag) { return (CFMutableBagRef)GSHashTableCreateMutableCopy (allocator, (GSHashTableRef)bag, capacity); }
CFMutableSetRef CFSetCreateMutableCopy (CFAllocatorRef allocator, CFIndex capacity, CFSetRef set) { CF_OBJC_FUNCDISPATCH0(_kCFSetTypeID, CFMutableSetRef, set, "copy"); return (CFMutableSetRef)GSHashTableCreateMutableCopy (allocator, (GSHashTableRef)set, capacity); }