ObjFW  Check-in [36d5f460a5]

Overview
Comment:Properly call initialize.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | runtime
Files: files | file ages | folders
SHA3-256: 36d5f460a5bba4eb646989a7714ec3475e2b63eec38d22c1cbcb9f84b7a327d3
User & Date: js on 2012-04-08 14:25:55
Other Links: branch diff | manifest | tags
Context
2012-04-08
14:51
lookup-x86-elf.S: Fix a typo. check-in: d72d924a00 user: js tags: runtime
14:25
Properly call initialize. check-in: 36d5f460a5 user: js tags: runtime
14:14
Add protocol_{getName,isEqual,conformsToProtocol}. check-in: b8744d8d68 user: js tags: runtime
Changes

Modified src/runtime/class.m from [1eef7dbe27] to [04350ea410].

178
179
180
181
182
183
184
















185
186
187
188
189
190
191

	objc_global_mutex_lock();
	c = (Class)objc_hashtable_get(classes, name);
	objc_global_mutex_unlock();

	return c;
}

















inline Class
objc_lookup_class(const char *name)
{
	Class cls = objc_classname_to_class(name);
	const char *superclass;








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207

	objc_global_mutex_lock();
	c = (Class)objc_hashtable_get(classes, name);
	objc_global_mutex_unlock();

	return c;
}

static void
call_initialize(Class cls)
{
	struct objc_method_list *ml;
	SEL initialize;
	unsigned int i;

	initialize = sel_registerName("initialize");

	for (ml = cls->isa->methodlist; ml != NULL; ml = ml->next)
		for (i = 0; i < ml->count; i++)
			if (sel_isEqual(&ml->methods[i].sel, initialize))
				((void(*)(id, SEL))ml->methods[i].imp)(cls,
				    initialize);
}

inline Class
objc_lookup_class(const char *name)
{
	Class cls = objc_classname_to_class(name);
	const char *superclass;

221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236

	objc_update_dtable(cls);
	objc_update_dtable(cls->isa);

	cls->info |= OBJC_CLASS_INFO_INITIALIZED;
	cls->isa->info |= OBJC_CLASS_INFO_INITIALIZED;

	if (class_respondsToSelector(cls->isa, @selector(initialize)))
		[cls initialize];

	objc_global_mutex_unlock();

	return cls;
}

Class







<
|







237
238
239
240
241
242
243

244
245
246
247
248
249
250
251

	objc_update_dtable(cls);
	objc_update_dtable(cls->isa);

	cls->info |= OBJC_CLASS_INFO_INITIALIZED;
	cls->isa->info |= OBJC_CLASS_INFO_INITIALIZED;


	call_initialize(cls);

	objc_global_mutex_unlock();

	return cls;
}

Class