| 264 | } |
| 265 | |
| 266 | void slab_allocator_registry_set(fl::size block_size, fl::size slab_size, void* allocator) { |
| 267 | // Check if already registered (update) |
| 268 | for (int i = 0; i < slab_registry_count; i++) { |
| 269 | if (slab_registry[i].block_size == block_size && |
| 270 | slab_registry[i].slab_size == slab_size) { |
| 271 | slab_registry[i].allocator = allocator; |
| 272 | return; |
| 273 | } |
| 274 | } |
| 275 | // Add new entry |
| 276 | if (slab_registry_count < SLAB_REGISTRY_MAX) { |
| 277 | slab_registry[slab_registry_count++] = {block_size, slab_size, allocator}; |
| 278 | } |
| 279 | } |
| 280 | |
| 281 | } // namespace detail |
| 282 | |