changed LZ4_calloc() to a 2-arguments signature
authorYann Collet <cyan@fb.com>
Mon, 9 Nov 2020 16:44:26 +0000 (08:44 -0800)
committerYann Collet <cyan@fb.com>
Mon, 9 Nov 2020 16:44:26 +0000 (08:44 -0800)
to remain similar to stdlib's calloc().

Updated test to use c++ compiler for stricter signature check.

.travis.yml
lib/lz4.c
tests/fullbench.c

index 31bc675a35be8e43570dcd2ccb3c6da03ec41fe4..f201d524a2722d92b5e954249997c5e2b39c3a33 100644 (file)
@@ -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
index 128e7b207d4017529d3447cf7865380453643417..5fe3433a419d066c505e9a4089b9ee4185280a48 100644 (file)
--- a/lib/lz4.c
+++ b/lib/lz4.c
  * 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 */
index 39932d235d3ba91c70b579a0b737927ad5389d9c..181128e6649276c615880b23db8d446ca4b7fbfc 100644 (file)
@@ -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); }