pub unsafe extern "C" fn hs_set_allocator(
    alloc_func: hs_alloc_t,
    free_func: hs_free_t
) -> hs_error_t
Expand description

Set the allocate and free functions used by Hyperscan for allocating memory at runtime for stream state, scratch space, database bytecode, and various other data structure returned by the Hyperscan API.

The function is equivalent to calling @ref hs_set_stream_allocator(), @ref hs_set_scratch_allocator(), @ref hs_set_database_allocator() and @ref hs_set_misc_allocator() with the provided parameters.

This call will override any previous allocators that have been set.

Note: there is no way to change the allocator used for temporary objects created during the various compile calls (@ref hs_compile(), @ref hs_compile_multi(), @ref hs_compile_ext_multi()).

@param alloc_func A callback function pointer that allocates memory. This function must return memory suitably aligned for the largest representable data type on this platform.

@param free_func A callback function pointer that frees allocated memory.

@return @ref HS_SUCCESS on success, other values on failure.