@@ -22,14 +22,14 @@ #include #import "ObjFWRT.h" #import "private.h" -struct objc_hashtable_bucket objc_deleted_bucket; +struct objc_hashtable_bucket objc_deletedBucket; uint32_t -objc_hash_string(const void *str_) +objc_string_hash(const void *str_) { const char *str = str_; uint32_t hash = 0; while (*str != 0) { @@ -45,11 +45,11 @@ return hash; } bool -objc_equal_string(const void *ptr1, const void *ptr2) +objc_string_equal(const void *ptr1, const void *ptr2) { return (strcmp(ptr1, ptr2) == 0); } struct objc_hashtable * @@ -101,11 +101,11 @@ if ((newData = calloc(newSize, sizeof(*newData))) == NULL) OBJC_ERROR("Not enough memory to resize hash table!"); for (uint32_t i = 0; i < table->size; i++) { if (table->data[i] != NULL && - table->data[i] != &objc_deleted_bucket) { + table->data[i] != &objc_deletedBucket) { uint32_t j, last; last = newSize; for (j = table->data[i]->hash & (newSize - 1); @@ -117,11 +117,11 @@ for (j = 0; j < last && newData[j] != NULL; j++); } if (j >= last) - OBJC_ERROR("No free bucket!"); + OBJC_ERROR("No free bucket in hash table!"); newData[j] = table->data[i]; } } @@ -136,11 +136,11 @@ uint32_t i, hash; hash = table->hash(key) & (table->size - 1); for (i = hash; i < table->size && table->data[i] != NULL; i++) { - if (table->data[i] == &objc_deleted_bucket) + if (table->data[i] == &objc_deletedBucket) continue; if (table->equal(table->data[i]->key, key)) { *idx = i; return true; @@ -149,11 +149,11 @@ if (i < table->size) return false; for (i = 0; i < hash && table->data[i] != NULL; i++) { - if (table->data[i] == &objc_deleted_bucket) + if (table->data[i] == &objc_deletedBucket) continue; if (table->equal(table->data[i]->key, key)) { *idx = i; return true; @@ -179,21 +179,21 @@ hash = table->hash(key); last = table->size; for (i = hash & (table->size - 1); i < last && table->data[i] != NULL && - table->data[i] != &objc_deleted_bucket; i++); + table->data[i] != &objc_deletedBucket; i++); if (i >= last) { last = hash & (table->size - 1); for (i = 0; i < last && table->data[i] != NULL && - table->data[i] != &objc_deleted_bucket; i++); + table->data[i] != &objc_deletedBucket; i++); } if (i >= last) - OBJC_ERROR("No free bucket!"); + OBJC_ERROR("No free bucket in hash table!"); if ((bucket = malloc(sizeof(*bucket))) == NULL) OBJC_ERROR("Not enough memory to allocate hash table bucket!"); bucket->key = key; @@ -222,11 +222,11 @@ if (!indexForKey(table, key, &idx)) return; free(table->data[idx]); - table->data[idx] = &objc_deleted_bucket; + table->data[idx] = &objc_deletedBucket; table->count--; resize(table, table->count); } @@ -233,11 +233,11 @@ void objc_hashtable_free(struct objc_hashtable *table) { for (uint32_t i = 0; i < table->size; i++) if (table->data[i] != NULL && - table->data[i] != &objc_deleted_bucket) + table->data[i] != &objc_deletedBucket) free(table->data[i]); free(table->data); free(table); }