added defaultCustomNULL

This commit is contained in:
inikep 2016-06-03 12:56:56 +02:00
parent c7f008b069
commit db2f540414
7 changed files with 9 additions and 13 deletions

View File

@ -259,5 +259,6 @@ int ZSTD_isSkipFrame(ZSTD_DCtx* dctx);
void* ZSTD_defaultAllocFunction(void* opaque, size_t size); void* ZSTD_defaultAllocFunction(void* opaque, size_t size);
void ZSTD_defaultFreeFunction(void* opaque, void* address); void ZSTD_defaultFreeFunction(void* opaque, void* address);
static ZSTD_customMem const defaultCustomMem = { ZSTD_defaultAllocFunction, ZSTD_defaultFreeFunction, NULL }; static ZSTD_customMem const defaultCustomMem = { ZSTD_defaultAllocFunction, ZSTD_defaultFreeFunction, NULL };
static ZSTD_customMem const defaultCustomNULL = { NULL, NULL, NULL };
#endif /* ZSTD_CCOMMON_H_MODULE */ #endif /* ZSTD_CCOMMON_H_MODULE */

View File

@ -100,8 +100,7 @@ struct ZBUFF_CCtx_s {
ZBUFF_CCtx* ZBUFF_createCCtx(void) ZBUFF_CCtx* ZBUFF_createCCtx(void)
{ {
ZSTD_customMem const customMem = { NULL, NULL, NULL }; return ZBUFF_createCCtx_advanced(defaultCustomNULL);
return ZBUFF_createCCtx_advanced(customMem);
} }
ZBUFF_CCtx* ZBUFF_createCCtx_advanced(ZSTD_customMem customMem) ZBUFF_CCtx* ZBUFF_createCCtx_advanced(ZSTD_customMem customMem)

View File

@ -122,8 +122,7 @@ struct ZSTD_CCtx_s
ZSTD_CCtx* ZSTD_createCCtx(void) ZSTD_CCtx* ZSTD_createCCtx(void)
{ {
ZSTD_customMem const customMem = { NULL, NULL, NULL }; return ZSTD_createCCtx_advanced(defaultCustomNULL);
return ZSTD_createCCtx_advanced(customMem);
} }
ZSTD_CCtx* ZSTD_createCCtx_advanced(ZSTD_customMem customMem) ZSTD_CCtx* ZSTD_createCCtx_advanced(ZSTD_customMem customMem)

View File

@ -88,8 +88,7 @@ struct ZBUFF_DCtx_s {
ZBUFF_DCtx* ZBUFF_createDCtx(void) ZBUFF_DCtx* ZBUFF_createDCtx(void)
{ {
ZSTD_customMem const customMem = { NULL, NULL, NULL }; return ZBUFF_createDCtx_advanced(defaultCustomNULL);
return ZBUFF_createDCtx_advanced(customMem);
} }
ZBUFF_DCtx* ZBUFF_createDCtx_advanced(ZSTD_customMem customMem) ZBUFF_DCtx* ZBUFF_createDCtx_advanced(ZSTD_customMem customMem)

View File

@ -172,8 +172,7 @@ ZSTD_DCtx* ZSTD_createDCtx_advanced(ZSTD_customMem customMem)
ZSTD_DCtx* ZSTD_createDCtx(void) ZSTD_DCtx* ZSTD_createDCtx(void)
{ {
ZSTD_customMem const customMem = { NULL, NULL, NULL }; return ZSTD_createDCtx_advanced(defaultCustomNULL);
return ZSTD_createDCtx_advanced(customMem);
} }

View File

@ -521,7 +521,6 @@ int main(int argc, const char** argv)
U32 mainPause = 0; U32 mainPause = 0;
const char* programName = argv[0]; const char* programName = argv[0];
ZSTD_customMem customMem = { ZBUFF_allocFunction, ZBUFF_freeFunction, NULL }; ZSTD_customMem customMem = { ZBUFF_allocFunction, ZBUFF_freeFunction, NULL };
ZSTD_customMem customNULL = { NULL, NULL, NULL };
/* Check command line */ /* Check command line */
for(argNb=1; argNb<argc; argNb++) { for(argNb=1; argNb<argc; argNb++) {
@ -621,7 +620,7 @@ int main(int argc, const char** argv)
if (nbTests<=0) nbTests=1; if (nbTests<=0) nbTests=1;
if (testNb==0) { if (testNb==0) {
result = basicUnitTests(0, ((double)proba) / 100, customNULL); /* constant seed for predictability */ result = basicUnitTests(0, ((double)proba) / 100, defaultCustomNULL); /* constant seed for predictability */
if (!result) { if (!result) {
DISPLAYLEVEL(4, "Unit tests using customMem :\n") DISPLAYLEVEL(4, "Unit tests using customMem :\n")
result = basicUnitTests(0, ((double)proba) / 100, customMem); /* use custom memory allocation functions */ result = basicUnitTests(0, ((double)proba) / 100, customMem); /* use custom memory allocation functions */

View File

@ -6,8 +6,8 @@
# Paths to static and dynamic zlib and zstd libraries # Paths to static and dynamic zlib and zstd libraries
ifneq (,$(filter Windows%,$(OS))) # Use "make ZLIBDIR=path/to/zlib" to select a path to library
ZLIBDIR = ../../zlib1.2.8 ifdef ZLIBDIR
STATICLIB = $(ZLIBDIR)/libz.a ../lib/libzstd.a STATICLIB = $(ZLIBDIR)/libz.a ../lib/libzstd.a
IMPLIB = $(ZLIBDIR)/libz.dll.a ../lib/libzstd.a IMPLIB = $(ZLIBDIR)/libz.dll.a ../lib/libzstd.a
else else