Differences From Artifact [a2a5089265]:
- File
src/OFBlock.m
— part of check-in
[2f4e0df8be]
at
2017-10-17 00:33:37
on branch trunk
— Do not use implicit method return types
Instead, explicitly declare them, as OF_ASSUME_NONNULL_{BEGIN,END} does
not apply to implicit return types. This means that after this commit,
all init methods have a nonnull return type, as they should have. (user: js, size: 12539) [annotate] [blame] [check-ins using]
To Artifact [5e4669db9b]:
- File src/OFBlock.m — part of check-in [0a4565fb0f] at 2017-11-05 18:25:38 on branch trunk — Use -[isMemberOfClass:] instead of object_getClass (user: js, size: 12533) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
159 160 161 162 163 164 165 | #endif void * _Block_copy(const void *block_) { of_block_literal_t *block = (of_block_literal_t *)block_; | | | | 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | #endif void * _Block_copy(const void *block_) { of_block_literal_t *block = (of_block_literal_t *)block_; if ([(id)block isMemberOfClass: (Class)&_NSConcreteStackBlock]) { of_block_literal_t *copy; if ((copy = malloc(block->descriptor->size)) == NULL) { alloc_failed_exception.isa = [OFAllocFailedException class]; @throw (OFAllocFailedException *) &alloc_failed_exception; } memcpy(copy, block, block->descriptor->size); object_setClass((id)copy, (Class)&_NSConcreteMallocBlock); copy->flags++; if (block->flags & OF_BLOCK_HAS_COPY_DISPOSE) block->descriptor->copy_helper(copy, block); return copy; } if ([(id)block isMemberOfClass: (Class)&_NSConcreteMallocBlock]) { #ifdef OF_HAVE_ATOMIC_OPS of_atomic_int_inc(&block->flags); #else unsigned hash = SPINLOCK_HASH(block); OF_ENSURE(of_spinlock_lock(&blockSpinlocks[hash])); block->flags++; |
︙ | ︙ | |||
462 463 464 465 466 467 468 | - (void)freeMemory: (void *)ptr { OF_UNRECOGNIZED_SELECTOR } - (instancetype)retain { | | | | | | 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 | - (void)freeMemory: (void *)ptr { OF_UNRECOGNIZED_SELECTOR } - (instancetype)retain { if ([self isMemberOfClass: (Class)&_NSConcreteMallocBlock]) return Block_copy(self); return self; } - (id)copy { return Block_copy(self); } - (instancetype)autorelease { if ([self isMemberOfClass: (Class)&_NSConcreteMallocBlock]) return [super autorelease]; return self; } - (unsigned int)retainCount { if ([self isMemberOfClass: (Class)&_NSConcreteMallocBlock]) return ((of_block_literal_t *)self)->flags & OF_BLOCK_REFCOUNT_MASK; return OF_RETAIN_COUNT_MAX; } - (void)release { if ([self isMemberOfClass: (Class)&_NSConcreteMallocBlock]) Block_release(self); } - (void)dealloc { OF_DEALLOC_UNSUPPORTED } @end |