ObjFW  Check-in [7025192253]

Overview
Comment:Allow passing NULL to _Block_object_assign() / _Block_object_dispose().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | 0.5
Files: files | file ages | folders
SHA3-256: 70251922538909fef6640837e82f7345169556a1dfc957aa7fae12fe622009cf
User & Date: js on 2011-07-14 21:18:10
Other Links: branch diff | manifest | tags
Context
2011-07-14
22:56
Fix missing return. check-in: 989d2c3e36 user: js tags: 0.5
21:18
Allow passing NULL to _Block_object_assign() / _Block_object_dispose(). check-in: 7025192253 user: js tags: 0.5
2011-07-12
23:13
Fix missing cast. check-in: c5e95e98ca user: js tags: 0.5
Changes

Modified src/OFBlock.m from [cb7452fd95] to [9f99b09857].

231
232
233
234
235
236
237



238
239
240
241
242
243
244
}

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







>
>
>







231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
}

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







>
>
>







274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
}

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