221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
|
if ((--block->flags & OF_BLOCK_REFCOUNT_MASK) == 0) {
assert(of_spinlock_unlock(&spinlocks[hash]));
if (block->flags & OF_BLOCK_HAS_COPY_DISPOSE)
block->descriptor->dispose_helper(block);
free(block);
}
assert(of_spinlock_unlock(&spinlocks[hash]));
#endif
}
void
_Block_object_assign(void *dst_, const void *src_, const int flags_)
{
int flags = flags_ & (OF_BLOCK_FIELD_IS_BLOCK |
OF_BLOCK_FIELD_IS_OBJECT | OF_BLOCK_FIELD_IS_BYREF);
switch (flags) {
case OF_BLOCK_FIELD_IS_BLOCK:
*(of_block_literal_t**)dst_ = _Block_copy(src_);
break;
case OF_BLOCK_FIELD_IS_OBJECT:
*(id*)dst_ = [(id)src_ retain];
|
>
>
>
>
>
|
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
|
if ((--block->flags & OF_BLOCK_REFCOUNT_MASK) == 0) {
assert(of_spinlock_unlock(&spinlocks[hash]));
if (block->flags & OF_BLOCK_HAS_COPY_DISPOSE)
block->descriptor->dispose_helper(block);
free(block);
return;
}
assert(of_spinlock_unlock(&spinlocks[hash]));
#endif
}
void
_Block_object_assign(void *dst_, const void *src_, const int flags_)
{
int flags = flags_ & (OF_BLOCK_FIELD_IS_BLOCK |
OF_BLOCK_FIELD_IS_OBJECT | OF_BLOCK_FIELD_IS_BYREF);
if (src_ == NULL)
return;
switch (flags) {
case OF_BLOCK_FIELD_IS_BLOCK:
*(of_block_literal_t**)dst_ = _Block_copy(src_);
break;
case OF_BLOCK_FIELD_IS_OBJECT:
*(id*)dst_ = [(id)src_ retain];
|
271
272
273
274
275
276
277
278
279
280
281
282
283
284
|
}
void
_Block_object_dispose(const void *obj_, const int flags_)
{
const int flags = flags_ & (OF_BLOCK_FIELD_IS_BLOCK |
OF_BLOCK_FIELD_IS_OBJECT | OF_BLOCK_FIELD_IS_BYREF);
switch (flags) {
case OF_BLOCK_FIELD_IS_BLOCK:
_Block_release(obj_);
break;
case OF_BLOCK_FIELD_IS_OBJECT:
[(id)obj_ release];
|
>
>
>
|
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
|
}
void
_Block_object_dispose(const void *obj_, const int flags_)
{
const int flags = flags_ & (OF_BLOCK_FIELD_IS_BLOCK |
OF_BLOCK_FIELD_IS_OBJECT | OF_BLOCK_FIELD_IS_BYREF);
if (obj_ == NULL)
return;
switch (flags) {
case OF_BLOCK_FIELD_IS_BLOCK:
_Block_release(obj_);
break;
case OF_BLOCK_FIELD_IS_OBJECT:
[(id)obj_ release];
|