| 391 | } |
| 392 | |
| 393 | HashStringAllocator::Header* FOLLY_NULLABLE |
| 394 | HashStringAllocator::allocateFromFreeLists( |
| 395 | int32_t preferredSize, |
| 396 | bool mustHaveSize, |
| 397 | bool isFinalSize) { |
| 398 | if (!numFree_) { |
| 399 | return nullptr; |
| 400 | } |
| 401 | preferredSize = std::max(kMinAlloc, preferredSize); |
| 402 | const auto index = freeListIndex(preferredSize); |
| 403 | auto available = bits::findFirstBit(freeNonEmpty_, index, kNumFreeLists); |
| 404 | if (!mustHaveSize && available == -1) { |
| 405 | available = bits::findLastBit(freeNonEmpty_, 0, index); |
| 406 | } |
| 407 | if (available == -1) { |
| 408 | return nullptr; |
| 409 | } |
| 410 | auto* header = |
| 411 | allocateFromFreeList(preferredSize, mustHaveSize, isFinalSize, available); |
| 412 | BOLT_CHECK_NOT_NULL(header); |
| 413 | return header; |
| 414 | } |
| 415 | |
| 416 | HashStringAllocator::Header* FOLLY_NULLABLE |
| 417 | HashStringAllocator::allocateFromFreeList( |
nothing calls this directly
no test coverage detected