From a29683980264b046797e207c6e995cae0a12b0a8 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Mon, 9 Nov 2020 08:44:26 -0800 Subject: changed LZ4_calloc() to a 2-arguments signature to remain similar to stdlib's calloc(). Updated test to use c++ compiler for stricter signature check. --- .travis.yml | 2 ++ lib/lz4.c | 4 ++-- tests/fullbench.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 31bc675..f201d52 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,6 +38,8 @@ matrix: - make -C programs lz4-wlib - make clean - make -C tests fullbench-wmalloc # test LZ4_USER_MEMORY_FUNCTIONS + - make clean + - CC="c++ -Wno-deprecated" make -C tests fullbench-wmalloc # stricter function signature check - name: (Precise) g++ and clang CMake test dist: precise diff --git a/lib/lz4.c b/lib/lz4.c index 128e7b2..5fe3433 100644 --- a/lib/lz4.c +++ b/lib/lz4.c @@ -193,10 +193,10 @@ * Below functions must exist somewhere in the Project * and be available at link time */ void* LZ4_malloc(size_t s); -void* LZ4_calloc(size_t s); +void* LZ4_calloc(size_t n, size_t s); void LZ4_free(void* p); # define ALLOC(s) LZ4_malloc(s) -# define ALLOC_AND_ZERO(s) LZ4_calloc(s) +# define ALLOC_AND_ZERO(s) LZ4_calloc(1,s) # define FREEMEM(p) LZ4_free(p) #else # include /* malloc, calloc, free */ diff --git a/tests/fullbench.c b/tests/fullbench.c index 39932d2..181128e 100644 --- a/tests/fullbench.c +++ b/tests/fullbench.c @@ -159,7 +159,7 @@ static size_t BMK_findMaxMem(U64 requiredMem) * Memory management, to test LZ4_USER_MEMORY_FUNCTIONS *********************************************************/ void* LZ4_malloc(size_t s) { return malloc(s); } -void* LZ4_calloc(size_t s) { return calloc(1,s); } +void* LZ4_calloc(size_t n, size_t s) { (void)n; return calloc(1,s); } void LZ4_free(void* p) { free(p); } -- cgit v0.12