Differences From Artifact [ca01b62fa9]:
- File
src/runtime/category.m
— part of check-in
[ef6d69931e]
at
2019-02-07 00:46:41
on branch trunk
— Make style consistent between ObjFW and ObjFW_RT
ObjFW_RT used to be a separate project that followed the BSD style, as
it was written in pure C, while ObjFW's style is based on the BSD style
with changes to make it a better fit for Objective-C. This commit
changes ObjFW_RT to use the same style as ObjFW. (user: js, size: 3680) [annotate] [blame] [check-ins using]
To Artifact [153181212b]:
- File src/runtime/category.m — part of check-in [754bf24742] at 2019-02-07 21:31:16 on branch trunk — More style improvements (user: js, size: 3702) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
43 44 45 46 47 48 49 | &methodList->methods[i]); } static void registerCategory(struct objc_abi_category *category) { struct objc_abi_category **categories; | | | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | &methodList->methods[i]); } static void registerCategory(struct objc_abi_category *category) { struct objc_abi_category **categories; Class class = objc_classname_to_class(category->className, false); if (categoriesMap == NULL) categoriesMap = objc_hashtable_new( objc_hash_string, objc_equal_string, 2); categories = (struct objc_abi_category **)objc_hashtable_get( categoriesMap, category->className); |
︙ | ︙ | |||
69 70 71 72 73 74 75 | category->className); newCategories[i] = category; newCategories[i + 1] = NULL; objc_hashtable_set(categoriesMap, category->className, newCategories); | | | | | | | | | | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | category->className); newCategories[i] = category; newCategories[i + 1] = NULL; objc_hashtable_set(categoriesMap, category->className, newCategories); if (class != Nil && class->info & OBJC_CLASS_INFO_SETUP) { objc_update_dtable(class); objc_update_dtable(class->isa); } return; } if ((categories = malloc( 2 * sizeof(struct objc_abi_category *))) == NULL) OBJC_ERROR("Not enough memory for category %s of class %s!\n", category->categoryName, category->className); categories[0] = category; categories[1] = NULL; objc_hashtable_set(categoriesMap, category->className, categories); if (class != Nil && class->info & OBJC_CLASS_INFO_SETUP) { objc_update_dtable(class); objc_update_dtable(class->isa); } } void objc_register_all_categories(struct objc_abi_symtab *symtab) { struct objc_abi_category **categories = (struct objc_abi_category **)symtab->defs + symtab->classDefsCount; for (size_t i = 0; i < symtab->categoryDefsCount; i++) { registerSelectors(categories[i]); registerCategory(categories[i]); } } struct objc_category ** objc_categories_for_class(Class class) { if (categoriesMap == NULL) return NULL; return (struct objc_category **)objc_hashtable_get(categoriesMap, class->name); } void objc_unregister_all_categories(void) { if (categoriesMap == NULL) return; |
︙ | ︙ |