Differences From Artifact [57debffc40]:
- File
src/runtime/selector.m
— part of check-in
[4af49a13c3]
at
2017-05-07 20:10:13
on branch trunk
— Small code style change
Casts are now written like types in variable declarations. (user: js, size: 3448) [annotate] [blame] [check-ins using] [more...]
To Artifact [f5a125315c]:
- File
src/runtime/selector.m
— part of check-in
[79011c5f56]
at
2017-06-07 21:38:21
on branch trunk
— runtime: Move all globals into a single struct
This is required to create a .library on MorphOS. (user: js, size: 3547) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
29 30 31 32 33 34 35 | # define SEL_MAX 0xFFFFFF # define SEL_SIZE 3 #else # define SEL_MAX 0xFFFF # define SEL_SIZE 2 #endif | > | | | > | < | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | # define SEL_MAX 0xFFFFFF # define SEL_SIZE 3 #else # define SEL_MAX 0xFFFF # define SEL_SIZE 2 #endif #import "globals.h" #define selectors objc_globals.selectors #define selectors_cnt objc_globals.selectors_cnt #define selector_names objc_globals.selector_names #define ptrs_to_free objc_globals.ptrs_to_free #define ptrs_to_free_cnt objc_globals.ptrs_to_free_cnt void objc_register_selector(struct objc_abi_selector *sel) { struct objc_selector *rsel; const char *name; |
︙ | ︙ | |||
85 86 87 88 89 90 91 | OBJC_ERROR("Not enough memory to allocate selector!"); if ((sel->name = of_strdup(name)) == NULL) OBJC_ERROR("Not enough memory to allocate selector!"); sel->types = NULL; | | | | | | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | OBJC_ERROR("Not enough memory to allocate selector!"); if ((sel->name = of_strdup(name)) == NULL) OBJC_ERROR("Not enough memory to allocate selector!"); sel->types = NULL; if ((ptrs_to_free = realloc(ptrs_to_free, sizeof(void *) * (ptrs_to_free_cnt + 2))) == NULL) OBJC_ERROR("Not enough memory to allocate selector!"); ptrs_to_free[ptrs_to_free_cnt++] = sel; ptrs_to_free[ptrs_to_free_cnt++] = (char *)sel->name; objc_register_selector(sel); objc_global_mutex_unlock(); return (SEL)sel; } |
︙ | ︙ | |||
134 135 136 137 138 139 140 | void objc_unregister_all_selectors(void) { objc_hashtable_free(selectors); objc_sparsearray_free(selector_names); | | | | | | | | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | void objc_unregister_all_selectors(void) { objc_hashtable_free(selectors); objc_sparsearray_free(selector_names); if (ptrs_to_free != NULL) { for (size_t i = 0; i < ptrs_to_free_cnt; i++) free(ptrs_to_free[i]); free(ptrs_to_free); } selectors = NULL; selectors_cnt = 0; selector_names = NULL; ptrs_to_free = NULL; ptrs_to_free_cnt = 0; } |