ObjFW  Check-in [19890b42b2]

Overview
Comment:GCC always defines self as struct objc_class, even for class methods.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 19890b42b27ea6ed40a807d33f378d8787c0c87ecef7a43db55d8aade5630ea0
User & Date: js on 2010-03-04 21:37:48
Other Links: manifest | tags
Context
2010-03-04
22:26
Update .xcodeproj to include new files. check-in: e99fed9270 user: js tags: trunk
21:37
GCC always defines self as struct objc_class, even for class methods. check-in: 19890b42b2 user: js tags: trunk
12:28
Add +[setImplemenation:forClassMethod:] and friends. check-in: a4b1a005b6 user: js tags: trunk
Changes

Modified src/OFObject.m from [69ac875773] to [864eafb36e].

232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
	if ((oldimp = method_get_imp(method)) == (IMP)0 || newimp == (IMP)0)
		@throw [OFInvalidArgumentException newWithClass: self
						       selector: _cmd];

	method->method_imp = newimp;

	/* Update the dtable if necessary */
	if (sarray_get_safe(self->class_pointer->dtable,
	    (sidx)method->method_name->sel_id))
		sarray_at_put_safe(self->class_pointer->dtable,
		    (sidx)method->method_name->sel_id, method->method_imp);

	return oldimp;
#endif
}

+  (IMP)replaceClassMethod: (SEL)selector







|

|







232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
	if ((oldimp = method_get_imp(method)) == (IMP)0 || newimp == (IMP)0)
		@throw [OFInvalidArgumentException newWithClass: self
						       selector: _cmd];

	method->method_imp = newimp;

	/* Update the dtable if necessary */
	if (sarray_get_safe(((Class)self->class_pointer)->dtable,
	    (sidx)method->method_name->sel_id))
		sarray_at_put_safe(((Class)self->class_pointer)->dtable,
		    (sidx)method->method_name->sel_id, method->method_imp);

	return oldimp;
#endif
}

+  (IMP)replaceClassMethod: (SEL)selector
285
286
287
288
289
290
291

292
293
294
295
296
297
298
299
300
	if ((oldimp = method_get_imp(method)) == (IMP)0 || newimp == (IMP)0)
		@throw [OFInvalidArgumentException newWithClass: self
						       selector: _cmd];

	method->method_imp = newimp;

	/* Update the dtable if necessary */

	if (sarray_get_safe(self->dtable, (sidx)method->method_name->sel_id))
		sarray_at_put_safe(self->dtable,
		    (sidx)method->method_name->sel_id, method->method_imp);

	return oldimp;
#endif
}

+  (IMP)replaceInstanceMethod: (SEL)selector







>
|
|







285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
	if ((oldimp = method_get_imp(method)) == (IMP)0 || newimp == (IMP)0)
		@throw [OFInvalidArgumentException newWithClass: self
						       selector: _cmd];

	method->method_imp = newimp;

	/* Update the dtable if necessary */
	if (sarray_get_safe(((Class)self)->dtable,
	    (sidx)method->method_name->sel_id))
		sarray_at_put_safe(((Class)self)->dtable,
		    (sidx)method->method_name->sel_id, method->method_imp);

	return oldimp;
#endif
}

+  (IMP)replaceInstanceMethod: (SEL)selector