diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2023-03-02 09:19:48 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2023-03-02 09:19:48 +0000 |
commit | 77dc28d43e0f0a3a2ec7c61b3d6c9be8a4d0fa45 (patch) | |
tree | 9a5de720c81ad9403451b04adcb62ba010a1fad7 /contrib/zstd/zstd_common.c | |
parent | 5e792b26110c4b84c93b2cc724d656f6d96b5135 (diff) | |
download | rspamd-77dc28d43e0f0a3a2ec7c61b3d6c9be8a4d0fa45.tar.gz rspamd-77dc28d43e0f0a3a2ec7c61b3d6c9be8a4d0fa45.zip |
[Minor] Update zstd to 1.5.4
Diffstat (limited to 'contrib/zstd/zstd_common.c')
-rw-r--r-- | contrib/zstd/zstd_common.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/contrib/zstd/zstd_common.c b/contrib/zstd/zstd_common.c index 91fe3323a..320855247 100644 --- a/contrib/zstd/zstd_common.c +++ b/contrib/zstd/zstd_common.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -13,8 +13,8 @@ /*-************************************* * Dependencies ***************************************/ -#include <stdlib.h> /* malloc, calloc, free */ -#include <string.h> /* memset */ +#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" @@ -53,31 +53,31 @@ const char* ZSTD_getErrorString(ZSTD_ErrorCode code) { return ERR_getErrorString /*=************************************************************** * Custom allocator ****************************************************************/ -void* ZSTD_malloc(size_t size, ZSTD_customMem customMem) +void* ZSTD_customMalloc(size_t size, ZSTD_customMem customMem) { if (customMem.customAlloc) return customMem.customAlloc(customMem.opaque, size); - return malloc(size); + return ZSTD_malloc(size); } -void* ZSTD_calloc(size_t size, ZSTD_customMem customMem) +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); - memset(ptr, 0, size); + ZSTD_memset(ptr, 0, size); return ptr; } - return calloc(1, size); + return ZSTD_calloc(1, size); } -void ZSTD_free(void* ptr, ZSTD_customMem customMem) +void ZSTD_customFree(void* ptr, ZSTD_customMem customMem) { if (ptr!=NULL) { if (customMem.customFree) customMem.customFree(customMem.opaque, ptr); else - free(ptr); + ZSTD_free(ptr); } } |