Allocator for zstd compression context using mempool_allocator */
| 552 | |
| 553 | /* Allocator for zstd compression context using mempool_allocator */ |
| 554 | static void * |
| 555 | zstd_alloc(void *opaque __maybe_unused, size_t size) |
| 556 | { |
| 557 | size_t nbytes = sizeof (struct zstd_kmem) + size; |
| 558 | struct zstd_kmem *z = NULL; |
| 559 | |
| 560 | z = (struct zstd_kmem *)zstd_mempool_alloc(zstd_mempool_cctx, nbytes); |
| 561 | |
| 562 | if (!z) { |
| 563 | ZSTDSTAT_BUMP(zstd_stat_alloc_fail); |
| 564 | return (NULL); |
| 565 | } |
| 566 | |
| 567 | return ((void*)z + (sizeof (struct zstd_kmem))); |
| 568 | } |
| 569 | |
| 570 | /* |
| 571 | * Allocator for zstd decompression context using mempool_allocator with |
nothing calls this directly
no test coverage detected