Differences From Artifact [f1cf7ae4d1]:
- File
src/runtime/hashtable.m
— part of check-in
[9da9b2b64c]
at
2014-04-14 00:45:58
on branch trunk
— Coding style
No functional change intended. (user: js, size: 5070) [annotate] [blame] [check-ins using]
To Artifact [bfc4832e86]:
- File
src/runtime/hashtable.m
— part of check-in
[428520105b]
at
2014-05-15 03:39:47
on branch trunk
— objc_exit(): Fix the first class not being free'd
Also cleans up runtime/hashtable.m a little. (user: js, size: 5063) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
83 84 85 86 87 88 89 | if (count > UINT32_MAX / sizeof(*table->data) || count > UINT32_MAX / 8) OBJC_ERROR("Integer overflow!"); fullness = count * 8 / table->size; if (fullness >= 6) { if (table->size > UINT32_MAX / 2) | | > > > | < | | 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 | if (count > UINT32_MAX / sizeof(*table->data) || count > UINT32_MAX / 8) OBJC_ERROR("Integer overflow!"); fullness = count * 8 / table->size; if (fullness >= 6) { if (table->size > UINT32_MAX / 2) return; nsize = table->size * 2; } else if (fullness <= 1) nsize = table->size / 2; else return; if (count < table->count && nsize < 16) return; if ((ndata = calloc(nsize, sizeof(sizeof(*ndata)))) == NULL) OBJC_ERROR("Not enough memory to resize hash table!"); for (i = 0; i < table->size; i++) { if (table->data[i] != NULL && table->data[i] != &objc_deleted_bucket) { uint32_t j, last; last = nsize; |
︙ | ︙ | |||
186 187 188 189 190 191 192 | for (i = 0; i < last && table->data[i] != NULL && table->data[i] != &objc_deleted_bucket; i++); } if (i >= last) OBJC_ERROR("No free bucket!"); | | | 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | for (i = 0; i < last && table->data[i] != NULL && table->data[i] != &objc_deleted_bucket; i++); } if (i >= last) OBJC_ERROR("No free bucket!"); if ((bucket = malloc(sizeof(*bucket))) == NULL) OBJC_ERROR("Not enough memory to allocate hash table bucket!"); bucket->key = key; bucket->hash = hash; bucket->obj = obj; table->data[i] = bucket; |
︙ | ︙ |