ObjFW  Diff

Differences From Artifact [f102f6c695]:

To Artifact [995214f475]:

  • File src/OFBlock.m — part of check-in [f78e4e4714] at 2010-10-05 20:01:08 on branch trunk — Remove -[autorelease] from OFBlock.

    The reason is that a block might be an NSBlock on OS X where it would
    add the block to an NSAutoreleasePool. This change forces the developer
    to use [OFAutoreleasePool addObject: block], which will also work if
    the block is an NSBlock. Thus, this change is to force developers to
    write portable code. (user: js, size: 5408) [annotate] [blame] [check-ins using]


210
211
212
213
214
215
216
217
218
219
220
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
250

			free(obj);
		}
		break;
	}
}

static Class autoreleasepool = Nil;

/// \cond internal
@implementation OFBlock
+ (Class)class
{
	return self;
}

- copy
{
	return Block_copy(self);
}

- (void)release
{
	Block_release(self);
}

- autorelease
{
	/*
	 * Cache OFAutoreleasePool since class lookups are expensive with the
	 * GNU runtime.
	 */
	if (autoreleasepool == Nil)
		autoreleasepool = [OFAutoreleasePool class];

	[autoreleasepool addObject: self];

	return self;
}
@end
/// \endcond







<
<
















<
<
<
<
<
<
<
<
<
<
<
<
<
<


210
211
212
213
214
215
216


217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232














233
234

			free(obj);
		}
		break;
	}
}



/// \cond internal
@implementation OFBlock
+ (Class)class
{
	return self;
}

- copy
{
	return Block_copy(self);
}

- (void)release
{
	Block_release(self);
}














@end
/// \endcond