pub unsafe extern "C" fn ddwaf_allocator_alloc(
alloc: ddwaf_allocator,
bytes: usize,
alignment: usize,
) -> *mut c_voidExpand description
Allocates a block of memory from the given allocator with the requested alignment.
Usage and guarantees:
- The returned pointer is aligned to
alignmentbytes. - Returns NULL on allocation failure.
- Memory obtained with this function must be released with
ddwaf_allocator_free using the same allocator and the same
bytesandalignmentvalues. - Thread-safety depends on the allocator type; see the corresponding allocator init function for details.
@param alloc Allocator to use for the allocation. (nonnull) @param bytes Number of bytes to allocate. @param alignment Required alignment in bytes; must be a power of two.
@return Pointer to the allocated memory or NULL on failure.