From 0bdb6a81185c7df17af386441e6d729767a64a81 Mon Sep 17 00:00:00 2001 From: inikep Date: Fri, 13 May 2016 10:52:02 +0200 Subject: [PATCH] changed definition of UTIL_createFileList --- programs/bench.c | 2 +- programs/util.h | 52 ++++++++++++++++++++++++------------------- zlibWrapper/README.md | 7 +++--- 3 files changed, 34 insertions(+), 27 deletions(-) diff --git a/programs/bench.c b/programs/bench.c index bc77fe059..bed7d16bc 100644 --- a/programs/bench.c +++ b/programs/bench.c @@ -513,7 +513,7 @@ int BMK_benchFiles(const char** fileNamesTable, unsigned nbFiles, char* buf; const char** filenameTable; unsigned i; - nbFiles = UTIL_createFileList(fileNamesTable, nbFiles, &filenameTable, &buf); + filenameTable = UTIL_createFileList(fileNamesTable, nbFiles, &buf, &nbFiles); if (filenameTable) { for (i=0; i bufend) { free(buf); free((void*)fileTable); return NULL; } + + *allocatedBuffer = buf; + *allocatedNamesNb = nbFiles; + + return fileTable; } -UTIL_STATIC void UTIL_freeFileList(const char** filenameTable, char* buf) +UTIL_STATIC void UTIL_freeFileList(const char** filenameTable, char* allocatedBuffer) { - free(buf); - free((void*)filenameTable); + if (allocatedBuffer) free(allocatedBuffer); + if (filenameTable) free((void*)filenameTable); } diff --git a/zlibWrapper/README.md b/zlibWrapper/README.md index ccc8c3ffa..272f7b99c 100644 --- a/zlibWrapper/README.md +++ b/zlibWrapper/README.md @@ -29,7 +29,7 @@ The linking should be changed to: ```gcc project.o zlib_wrapper.o -lz -lzstd``` -#### Using the zstd wrapper with your project +#### Enabling zstd compression within your project After embedding the zstd wrapper within your project the zstd library is turned off by default. Your project should work as before with zlib. There are two options to enable zstd compression: @@ -51,8 +51,9 @@ large_inflate(): OK after inflateSync(): hello, hello! inflate with dictionary: hello, hello! ``` -Then we have compiled the [example.c](examples/example.c) file with ```-DZWRAP_USE_ZSTD=1``` and linked with additional ```zlib_wrapper.o -lzstd```. -We have also turned of the following functions: test_gzio, test_flush, test_sync which use currently unsupported features. +Then we have changed ```#include "zlib.h"``` to ```#include "zstd_zlibwrapper.h"```, compiled the [example.c](examples/example.c) file +with ```-DZWRAP_USE_ZSTD=1``` and linked with additional ```zlib_wrapper.o -lzstd```. +We were forced to turn off the following functions: ```test_gzio```, ```test_flush```, ```test_sync``` which use currently unsupported features. After running it shows the following results: ``` zlib version 1.2.8 = 0x1280, compile flags = 0x65