summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2020-11-09 08:44:26 -0800
committerYann Collet <cyan@fb.com>2020-11-09 08:44:26 -0800
commita29683980264b046797e207c6e995cae0a12b0a8 (patch)
tree9dbf11978bb7518245ac343c33653c9b71e6a94b
parentadc46ea4c176380fb104273f66f1e618713a2481 (diff)
downloadlz4-a29683980264b046797e207c6e995cae0a12b0a8.tar.gz
lz4-a29683980264b046797e207c6e995cae0a12b0a8.tar.bz2
lz4-a29683980264b046797e207c6e995cae0a12b0a8.zip
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.
-rw-r--r--.travis.yml2
-rw-r--r--lib/lz4.c4
-rw-r--r--tests/fullbench.c2
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 <stdlib.h> /* 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); }