diff options
| author | robot-contrib <[email protected]> | 2023-04-20 12:08:07 +0300 |
|---|---|---|
| committer | robot-contrib <[email protected]> | 2023-04-20 12:08:07 +0300 |
| commit | eb16979262f120e52cda528d30de5a0cfb4ed0c9 (patch) | |
| tree | 4642aac240bc0889ba11a987e6748d4fabbc8230 /contrib/libs/zstd/lib/common/zstd_common.c | |
| parent | d0c642847472b3222a1a73a941917d393cc6ddf3 (diff) | |
Update contrib/libs/zstd to 1.5.5
Diffstat (limited to 'contrib/libs/zstd/lib/common/zstd_common.c')
| -rw-r--r-- | contrib/libs/zstd/lib/common/zstd_common.c | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/contrib/libs/zstd/lib/common/zstd_common.c b/contrib/libs/zstd/lib/common/zstd_common.c index 3208552475d..3f04c22abf6 100644 --- a/contrib/libs/zstd/lib/common/zstd_common.c +++ b/contrib/libs/zstd/lib/common/zstd_common.c @@ -14,7 +14,6 @@ * Dependencies ***************************************/ #define ZSTD_DEPS_NEED_MALLOC -#include "zstd_deps.h" /* ZSTD_malloc, ZSTD_calloc, ZSTD_free, ZSTD_memset */ #include "error_private.h" #include "zstd_internal.h" @@ -47,37 +46,3 @@ ZSTD_ErrorCode ZSTD_getErrorCode(size_t code) { return ERR_getErrorCode(code); } /*! ZSTD_getErrorString() : * provides error code string from enum */ const char* ZSTD_getErrorString(ZSTD_ErrorCode code) { return ERR_getErrorString(code); } - - - -/*=************************************************************** -* Custom allocator -****************************************************************/ -void* ZSTD_customMalloc(size_t size, ZSTD_customMem customMem) -{ - if (customMem.customAlloc) - return customMem.customAlloc(customMem.opaque, size); - return ZSTD_malloc(size); -} - -void* ZSTD_customCalloc(size_t size, ZSTD_customMem customMem) -{ - if (customMem.customAlloc) { - /* calloc implemented as malloc+memset; - * not as efficient as calloc, but next best guess for custom malloc */ - void* const ptr = customMem.customAlloc(customMem.opaque, size); - ZSTD_memset(ptr, 0, size); - return ptr; - } - return ZSTD_calloc(1, size); -} - -void ZSTD_customFree(void* ptr, ZSTD_customMem customMem) -{ - if (ptr!=NULL) { - if (customMem.customFree) - customMem.customFree(customMem.opaque, ptr); - else - ZSTD_free(ptr); - } -} |
