Differences From Artifact [bb1c57067e]:
- File src/OFMapTable.m — part of check-in [da1fb6b21c] at 2020-11-05 02:27:35 on branch trunk — Further reduce usage of -[allocMemoryWithSize:] (user: js, size: 16387) [annotate] [blame] [check-ins using] [more...]
To Artifact [6adf8ae2bb]:
- File
src/OFMapTable.m
— part of check-in
[627511b032]
at
2020-11-14 12:23:55
on branch trunk
— Rename of_malloc and of_calloc
The new names should be more accurate. (user: js, size: 16398) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
159 160 161 162 163 164 165 | if (capacity * 8 / _capacity >= 6) if (_capacity <= ULONG_MAX / 2) _capacity *= 2; if (_capacity < MIN_CAPACITY) _capacity = MIN_CAPACITY; | | | 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | if (capacity * 8 / _capacity >= 6) if (_capacity <= ULONG_MAX / 2) _capacity *= 2; if (_capacity < MIN_CAPACITY) _capacity = MIN_CAPACITY; _buckets = of_alloc_zeroed(_capacity, sizeof(*_buckets)); if (of_hash_seed != 0) _rotate = of_random16() & 31; } @catch (id e) { [self release]; @throw e; } |
︙ | ︙ | |||
321 322 323 324 325 326 327 | /* * Don't downsize if we have an initial capacity or if we would fall * below the minimum capacity. */ if ((capacity < _capacity && count > _count) || capacity < MIN_CAPACITY) return; | | | 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | /* * Don't downsize if we have an initial capacity or if we would fall * below the minimum capacity. */ if ((capacity < _capacity && count > _count) || capacity < MIN_CAPACITY) return; buckets = of_alloc_zeroed(capacity, sizeof(*buckets)); for (unsigned long i = 0; i < _capacity; i++) { if (_buckets[i] != NULL && _buckets[i] != &deleted) { unsigned long j, last; last = capacity; |
︙ | ︙ | |||
410 411 412 413 414 415 416 | for (i = 0; i < last && _buckets[i] != NULL && _buckets[i] != &deleted; i++); } if (i >= last) @throw [OFOutOfRangeException exception]; | | | 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 | for (i = 0; i < last && _buckets[i] != NULL && _buckets[i] != &deleted; i++); } if (i >= last) @throw [OFOutOfRangeException exception]; bucket = of_alloc(1, sizeof(*bucket)); @try { bucket->key = _keyFunctions.retain(key); } @catch (id e) { free(bucket); @throw e; } |
︙ | ︙ |