ObjFW  Check-in [9741a3d43b]

Overview
Comment:selector.m: Correctly check for slot exhaustion.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 9741a3d43b4937cf17d3559b8316ba1d8104a22e18192b8336f367e2092ec33a
User & Date: js on 2012-12-26 15:25:35
Other Links: manifest | tags
Context
2012-12-26
19:07
OFHTTPServer: Correctly put the query in the URL. check-in: f8a7660ac7 user: js tags: trunk
15:25
selector.m: Correctly check for slot exhaustion. check-in: 9741a3d43b user: js tags: trunk
14:10
OFProcess: Add a parameter for the environment. check-in: 891c0faad4 user: js tags: trunk
Changes

Modified src/runtime/selector.m from [c767975d02] to [80ce19c002].

35
36
37
38
39
40
41



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65

void
objc_register_selector(struct objc_abi_selector *sel)
{
	struct objc_selector *rsel;
	const char *name;




	if (selectors == NULL)
		selectors = objc_hashtable_new(2);
	else if ((rsel = objc_hashtable_get(selectors, sel->name)) != NULL) {
		((struct objc_selector*)sel)->uid = rsel->uid;
		return;
	}

	if (selector_names == NULL)
		selector_names = objc_sparsearray_new();

	name = sel->name;
	rsel = (struct objc_selector*)sel;
	rsel->uid = selectors_cnt++;

	if (selectors_cnt > SEL_MAX)
		OBJC_ERROR("Out of selector slots!");

	objc_hashtable_set(selectors, name, rsel);
	objc_sparsearray_set(selector_names, (uint32_t)rsel->uid, name);
}

SEL
sel_registerName(const char *name)
{







>
>
>














<
<
<







35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58



59
60
61
62
63
64
65

void
objc_register_selector(struct objc_abi_selector *sel)
{
	struct objc_selector *rsel;
	const char *name;

	if (selectors_cnt > SEL_MAX)
		OBJC_ERROR("Out of selector slots!");

	if (selectors == NULL)
		selectors = objc_hashtable_new(2);
	else if ((rsel = objc_hashtable_get(selectors, sel->name)) != NULL) {
		((struct objc_selector*)sel)->uid = rsel->uid;
		return;
	}

	if (selector_names == NULL)
		selector_names = objc_sparsearray_new();

	name = sel->name;
	rsel = (struct objc_selector*)sel;
	rsel->uid = selectors_cnt++;




	objc_hashtable_set(selectors, name, rsel);
	objc_sparsearray_set(selector_names, (uint32_t)rsel->uid, name);
}

SEL
sel_registerName(const char *name)
{