ObjFW  Check-in [017a85770c]

Overview
Comment:Allow passing NULL to _Block_object_assign() / _Block_object_dispose().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 017a85770ce78675a83fce922d8a790958fb869e6d6907e90a15df812c061a82
User & Date: js on 2011-07-14 21:18:10
Other Links: manifest | tags
Context
2011-07-14
22:56
Fix missing return. check-in: 7455987d6e user: js tags: trunk
21:18
Allow passing NULL to _Block_object_assign() / _Block_object_dispose(). check-in: 017a85770c user: js tags: trunk
2011-07-12
23:13
Fix missing cast. check-in: 8c40feec2b user: js tags: trunk
Changes

Modified src/OFBlock.m from [4ae738487f] to [c584d16b63].

260
261
262
263
264
265
266



267
268
269
270
271
272
273
}

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];







>
>
>







260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
}

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];
300
301
302
303
304
305
306



307
308
309
310
311
312
313
}

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];







>
>
>







303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
}

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];