Differences From Artifact [f1aef89fda]:
- File
src/runtime/selector.m
— part of check-in
[e5b241b72d]
at
2012-07-09 21:10:59
on branch trunk
— Fix two bugs in sel_registerName.
The first was that sel_registerName would crash if no selector has ever
been registered before. This caused a crash on NetBSD in has_load, as
the first class being loaded there (Protocol) had no selectors and
has_load uses sel_registerName in order to get the load selector.The second one was that the hashtable was read without a lock to see if
the selector has already been registered before. (user: js, size: 2851) [annotate] [blame] [check-ins using]
To Artifact [c767975d02]:
- File
src/runtime/selector.m
— part of check-in
[345eb93240]
at
2012-07-17 01:09:50
on branch trunk
— Rename ERROR() to OBJC_ERROR().
ERROR seems to be defined on MinGW32 and it's likely that it's also used
on other systems, thus it's better to prefix it with OBJC_. (user: js, size: 2866) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
50 51 52 53 54 55 56 | selector_names = objc_sparsearray_new(); name = sel->name; rsel = (struct objc_selector*)sel; rsel->uid = selectors_cnt++; if (selectors_cnt > SEL_MAX) | | | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | 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) |
︙ | ︙ | |||
72 73 74 75 76 77 78 | (rsel = objc_hashtable_get(selectors, name)) != NULL) { objc_global_mutex_unlock(); return (SEL)rsel; } /* FIXME: Free on objc_exit() */ if ((sel = malloc(sizeof(struct objc_abi_selector))) == NULL) | | | | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | (rsel = objc_hashtable_get(selectors, name)) != NULL) { objc_global_mutex_unlock(); return (SEL)rsel; } /* FIXME: Free on objc_exit() */ if ((sel = malloc(sizeof(struct objc_abi_selector))) == NULL) OBJC_ERROR("Not enough memory to allocate selector!"); if ((sel->name = strdup(name)) == NULL) OBJC_ERROR("Not enough memory to allocate selector!"); sel->types = NULL; objc_register_selector(sel); objc_global_mutex_unlock(); return (SEL)sel; |
︙ | ︙ |