- switch (__CFBitVectorMutableVarietyFromFlags(flags)) {
- case kCFBitVectorMutable:
- __CFBitVectorSetCapacity(memory, __CFBitVectorRoundUpCapacity(1));
- __CFBitVectorSetNumBuckets(memory, __CFBitVectorNumBucketsForCapacity(__CFBitVectorRoundUpCapacity(1)));
- CF_WRITE_BARRIER_BASE_ASSIGN(allocator, memory, memory->_buckets, _CFAllocatorAllocateGC(allocator, __CFBitVectorNumBuckets(memory) * sizeof(__CFBitVectorBucket), 0));
- if (__CFOASafe) __CFSetLastAllocationEventName(memory->_buckets, "CFBitVector (store)");
- if (NULL == memory->_buckets) {
- CFRelease(memory);
- return NULL;
- }
- break;
- case kCFBitVectorFixedMutable:
- case kCFBitVectorImmutable:
- /* Don't round up capacity */
- __CFBitVectorSetCapacity(memory, capacity);
- __CFBitVectorSetNumBuckets(memory, __CFBitVectorNumBucketsForCapacity(capacity));
- memory->_buckets = (__CFBitVectorBucket *)((int8_t *)memory + sizeof(struct __CFBitVector));
- break;
+ __CFBitVectorSetCapacity(memory, __CFBitVectorRoundUpCapacity(numBits));
+ __CFBitVectorSetNumBuckets(memory, __CFBitVectorNumBucketsForCapacity(__CFBitVectorRoundUpCapacity(numBits)));
+ __CFAssignWithWriteBarrier((void **)&memory->_buckets, _CFAllocatorAllocateGC(allocator, __CFBitVectorNumBuckets(memory) * sizeof(__CFBitVectorBucket), 0));
+ if (__CFOASafe) __CFSetLastAllocationEventName(memory->_buckets, "CFBitVector (store)");
+ if (NULL == memory->_buckets) {
+ CFRelease(memory);
+ return NULL;