@@ -21,71 +21,69 @@ #include #import "ObjFW_RT.h" #import "private.h" -static struct objc_dtable_level2 *empty_level2 = NULL; +static struct objc_dtable_level2 *emptyLevel2 = NULL; #ifdef OF_SELUID24 -static struct objc_dtable_level3 *empty_level3 = NULL; +static struct objc_dtable_level3 *emptyLevel3 = NULL; #endif static void init(void) { - empty_level2 = malloc(sizeof(struct objc_dtable_level2)); - if (empty_level2 == NULL) + if ((emptyLevel2 = malloc(sizeof(struct objc_dtable_level2))) == NULL) OBJC_ERROR("Not enough memory to allocate dtable!"); #ifdef OF_SELUID24 - empty_level3 = malloc(sizeof(struct objc_dtable_level3)); - if (empty_level3 == NULL) + if ((emptyLevel3 = malloc(sizeof(struct objc_dtable_level3))) == NULL) OBJC_ERROR("Not enough memory to allocate dtable!"); #endif #ifdef OF_SELUID24 for (uint_fast16_t i = 0; i < 256; i++) { - empty_level2->buckets[i] = empty_level3; - empty_level3->buckets[i] = (IMP)0; + emptyLevel2->buckets[i] = emptyLevel3; + emptyLevel3->buckets[i] = (IMP)0; } #else for (uint_fast16_t i = 0; i < 256; i++) - empty_level2->buckets[i] = (IMP)0; + emptyLevel2->buckets[i] = (IMP)0; #endif } struct objc_dtable * objc_dtable_new(void) { - struct objc_dtable *dtable; + struct objc_dtable *DTable; #ifdef OF_SELUID24 - if (empty_level2 == NULL || empty_level3 == NULL) + if (emptyLevel2 == NULL || emptyLevel3 == NULL) init(); #else - if (empty_level2 == NULL) + if (emptyLevel2 == NULL) init(); #endif - if ((dtable = malloc(sizeof(struct objc_dtable))) == NULL) + if ((DTable = malloc(sizeof(struct objc_dtable))) == NULL) OBJC_ERROR("Not enough memory to allocate dtable!"); for (uint_fast16_t i = 0; i < 256; i++) - dtable->buckets[i] = empty_level2; + DTable->buckets[i] = emptyLevel2; - return dtable; + return DTable; } void objc_dtable_copy(struct objc_dtable *dst, struct objc_dtable *src) { for (uint_fast16_t i = 0; i < 256; i++) { - if (src->buckets[i] == empty_level2) + if (src->buckets[i] == emptyLevel2) continue; #ifdef OF_SELUID24 for (uint_fast16_t j = 0; j < 256; j++) { - if (src->buckets[i]->buckets[j] == empty_level3) + if (src->buckets[i]->buckets[j] == emptyLevel3) continue; for (uint_fast16_t k = 0; k < 256; k++) { IMP obj; uint32_t idx; @@ -125,29 +123,29 @@ #else uint8_t i = idx >> 8; uint8_t j = idx; #endif - if (dtable->buckets[i] == empty_level2) { + if (dtable->buckets[i] == emptyLevel2) { struct objc_dtable_level2 *level2 = malloc(sizeof(struct objc_dtable_level2)); if (level2 == NULL) OBJC_ERROR("Not enough memory to insert into dtable!"); for (uint_fast16_t l = 0; l < 256; l++) #ifdef OF_SELUID24 - level2->buckets[l] = empty_level3; + level2->buckets[l] = emptyLevel3; #else level2->buckets[l] = (IMP)0; #endif dtable->buckets[i] = level2; } #ifdef OF_SELUID24 - if (dtable->buckets[i]->buckets[j] == empty_level3) { + if (dtable->buckets[i]->buckets[j] == emptyLevel3) { struct objc_dtable_level3 *level3 = malloc(sizeof(struct objc_dtable_level3)); if (level3 == NULL) OBJC_ERROR("Not enough memory to insert into dtable!"); @@ -166,16 +164,16 @@ void objc_dtable_free(struct objc_dtable *dtable) { for (uint_fast16_t i = 0; i < 256; i++) { - if (dtable->buckets[i] == empty_level2) + if (dtable->buckets[i] == emptyLevel2) continue; #ifdef OF_SELUID24 for (uint_fast16_t j = 0; j < 256; j++) - if (dtable->buckets[i]->buckets[j] != empty_level3) + if (dtable->buckets[i]->buckets[j] != emptyLevel3) free(dtable->buckets[i]->buckets[j]); #endif free(dtable->buckets[i]); } @@ -184,17 +182,17 @@ } void objc_dtable_cleanup(void) { - if (empty_level2 != NULL) - free(empty_level2); + if (emptyLevel2 != NULL) + free(emptyLevel2); #ifdef OF_SELUID24 - if (empty_level3 != NULL) - free(empty_level3); + if (emptyLevel3 != NULL) + free(emptyLevel3); #endif - empty_level2 = NULL; + emptyLevel2 = NULL; #ifdef OF_SELUID24 - empty_level3 = NULL; + emptyLevel3 = NULL; #endif }