ObjFW  Check-in [f78e4e4714]

Overview
Comment: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.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: f78e4e47140da1556808562158c48a629c90d3c056cd820e26a86747cafb000b
User & Date: js on 2010-10-05 20:01:08
Other Links: manifest | tags
Context
2010-10-06
09:21
Fix x86(_64) asm for of_atomic_{or,and,xor}_32.
Improve x86(_64) asm for of_atomic_cmpswap_{32,ptr}.
check-in: 7334aa1c81 user: js tags: trunk
2010-10-05
20:01
Remove -[autorelease] from OFBlock. check-in: f78e4e4714 user: js tags: trunk
19:59
Add support for blocks to OFXMLParser. check-in: b5d7201385 user: js tags: trunk
Changes

Modified src/OFBlock.h from [b3a64f1a53] to [78089d079f].

73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
{
	Class isa;
}

+ (Class)class;
- copy;
- (void)release;
- autorelease;
@end

@interface OFStackBlock: OFBlock
@end

@interface OFGlobalBlock: OFBlock
@end

@interface OFMallocBlock: OFBlock
@end
/// \endcond







<











73
74
75
76
77
78
79

80
81
82
83
84
85
86
87
88
89
90
{
	Class isa;
}

+ (Class)class;
- copy;
- (void)release;

@end

@interface OFStackBlock: OFBlock
@end

@interface OFGlobalBlock: OFBlock
@end

@interface OFMallocBlock: OFBlock
@end
/// \endcond

Modified src/OFBlock.m from [f102f6c695] to [995214f475].

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