Index: src/runtime/class.m ================================================================== --- src/runtime/class.m +++ src/runtime/class.m @@ -724,11 +724,11 @@ const char *typeEncoding) { struct objc_method_list *methodList; /* FIXME: We need a way to free this at objc_exit() */ - if ((methodList = malloc(sizeof(struct objc_method_list))) == NULL) + if ((methodList = malloc(sizeof(*methodList))) == NULL) OBJC_ERROR("Not enough memory to replace method!"); methodList->next = class->methodList; methodList->count = 1; methodList->methods[0].selector.UID = selector->UID; Index: src/runtime/dtable.m ================================================================== --- src/runtime/dtable.m +++ src/runtime/dtable.m @@ -29,15 +29,15 @@ #endif static void init(void) { - if ((emptyLevel2 = malloc(sizeof(struct objc_dtable_level2))) == NULL) + if ((emptyLevel2 = malloc(sizeof(*emptyLevel2))) == NULL) OBJC_ERROR("Not enough memory to allocate dtable!"); #ifdef OF_SELUID24 - if ((emptyLevel3 = malloc(sizeof(struct objc_dtable_level3))) == NULL) + if ((emptyLevel3 = malloc(sizeof(*emptyLevel3))) == NULL) OBJC_ERROR("Not enough memory to allocate dtable!"); #endif #ifdef OF_SELUID24 for (uint_fast16_t i = 0; i < 256; i++) { @@ -61,11 +61,11 @@ #else if (emptyLevel2 == NULL) init(); #endif - if ((DTable = malloc(sizeof(struct objc_dtable))) == NULL) + if ((DTable = malloc(sizeof(*DTable))) == NULL) OBJC_ERROR("Not enough memory to allocate dtable!"); for (uint_fast16_t i = 0; i < 256; i++) DTable->buckets[i] = emptyLevel2; @@ -125,12 +125,11 @@ uint8_t i = idx >> 8; uint8_t j = idx; #endif if (DTable->buckets[i] == emptyLevel2) { - struct objc_dtable_level2 *level2 = - malloc(sizeof(struct objc_dtable_level2)); + struct objc_dtable_level2 *level2 = malloc(sizeof(*level2)); if (level2 == NULL) OBJC_ERROR("Not enough memory to insert into dtable!"); for (uint_fast16_t l = 0; l < 256; l++) @@ -143,12 +142,11 @@ DTable->buckets[i] = level2; } #ifdef OF_SELUID24 if (DTable->buckets[i]->buckets[j] == emptyLevel3) { - struct objc_dtable_level3 *level3 = - malloc(sizeof(struct objc_dtable_level3)); + struct objc_dtable_level3 *level3 = malloc(sizeof(*level3)); if (level3 == NULL) OBJC_ERROR("Not enough memory to insert into dtable!"); for (uint_fast16_t l = 0; l < 256; l++) Index: src/runtime/hashtable.m ================================================================== --- src/runtime/hashtable.m +++ src/runtime/hashtable.m @@ -58,11 +58,11 @@ objc_hashtable_new(uint32_t (*hash)(const void *), bool (*equal)(const void *, const void *), uint32_t size) { struct objc_hashtable *table; - if ((table = malloc(sizeof(struct objc_hashtable))) == NULL) + if ((table = malloc(sizeof(*table))) == NULL) OBJC_ERROR("Not enough memory to allocate hash table!"); table->hash = hash; table->equal = equal;