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_defaultFreeFunction(void* opaque, void* address);
static ZSTD_customMem const defaultCustomMem = { ZSTD_defaultAllocFunction, ZSTD_defaultFreeFunction, NULL };
static ZSTD_customMem const defaultCustomNULL = { NULL, NULL, NULL };
#endif /* ZSTD_CCOMMON_H_MODULE */

View File

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

View File

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

View File

@ -88,8 +88,7 @@ struct ZBUFF_DCtx_s {
ZBUFF_DCtx* ZBUFF_createDCtx(void)
{
ZSTD_customMem const customMem = { NULL, NULL, NULL };
return ZBUFF_createDCtx_advanced(customMem);
return ZBUFF_createDCtx_advanced(defaultCustomNULL);
}
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_customMem const customMem = { NULL, NULL, NULL };
return ZSTD_createDCtx_advanced(customMem);
return ZSTD_createDCtx_advanced(defaultCustomNULL);
}

View File

@ -521,7 +521,6 @@ int main(int argc, const char** argv)
U32 mainPause = 0;
const char* programName = argv[0];
ZSTD_customMem customMem = { ZBUFF_allocFunction, ZBUFF_freeFunction, NULL };
ZSTD_customMem customNULL = { NULL, NULL, NULL };
/* Check command line */
for(argNb=1; argNb<argc; argNb++) {
@ -621,7 +620,7 @@ int main(int argc, const char** argv)
if (nbTests<=0) nbTests=1;
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) {
DISPLAYLEVEL(4, "Unit tests using customMem :\n")
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
ifneq (,$(filter Windows%,$(OS)))
ZLIBDIR = ../../zlib1.2.8
# Use "make ZLIBDIR=path/to/zlib" to select a path to library
ifdef ZLIBDIR
STATICLIB = $(ZLIBDIR)/libz.a ../lib/libzstd.a
IMPLIB = $(ZLIBDIR)/libz.dll.a ../lib/libzstd.a
else