// Modify the local functions below should you wish to use some other memory routines
// for malloc(), free()
#include <stdlib.h>
-FORCE_INLINE void* XXH_malloc(size_t s)
-{
- return malloc(s);
-}
-FORCE_INLINE void XXH_free (void* p)
-{
- free(p);
-}
+FORCE_INLINE void* XXH_malloc(size_t s) { return malloc(s); }
+FORCE_INLINE void XXH_free (void* p) { free(p); }
// for memcpy()
#include <string.h>
FORCE_INLINE void* XXH_memcpy(void* dest, const void* src, size_t size)
XXH32_state_t* XXH32_createState(void)
{
XXH_STATIC_ASSERT(sizeof(XXH32_state_t) >= sizeof(XXH_istate32_t)); // A compilation error here means XXH32_state_t is not large enough
- return (XXH32_state_t*)malloc(sizeof(XXH32_state_t));
+ return (XXH32_state_t*)XXH_malloc(sizeof(XXH32_state_t));
}
XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr)
{
- free(statePtr);
+ XXH_free(statePtr);
return XXH_OK;
};
XXH64_state_t* XXH64_createState(void)
{
XXH_STATIC_ASSERT(sizeof(XXH64_state_t) >= sizeof(XXH_istate64_t)); // A compilation error here means XXH64_state_t is not large enough
- return (XXH64_state_t*)malloc(sizeof(XXH64_state_t));
+ return (XXH64_state_t*)XXH_malloc(sizeof(XXH64_state_t));
}
XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr)
{
- free(statePtr);
+ XXH_free(statePtr);
return XXH_OK;
};