code cleaning

This commit is contained in:
inikep
2016-05-05 13:58:56 +02:00
parent 0bd0faec32
commit 13c8424ea0
6 changed files with 12 additions and 23 deletions
+3 -3
View File
@@ -330,10 +330,10 @@ UTIL_STATIC int UTIL_createFileList(const char **inputNames, unsigned nbNames, u
char *pbuf, *bufend, *buf; char *pbuf, *bufend, *buf;
buf = (char*)malloc(maxListSize); buf = (char*)malloc(maxListSize);
if (!buf) { *filenameTable = NULL; return 0; } if (!buf) { *filenameTable = NULL; return 0; }
bufend = buf + maxListSize; bufend = buf + maxListSize;
for (i=0, pbuf = buf; i<nbNames; i++) { for (i=0, pbuf = buf; i<nbNames; i++) {
if (UTIL_doesFileExists(inputNames[i])) { if (UTIL_doesFileExists(inputNames[i])) {
// printf ("UTIL_doesFileExists=[%s]\n", inputNames[i]); // printf ("UTIL_doesFileExists=[%s]\n", inputNames[i]);
size_t len = strlen(inputNames[i]); size_t len = strlen(inputNames[i]);
@@ -347,7 +347,7 @@ UTIL_STATIC int UTIL_createFileList(const char **inputNames, unsigned nbNames, u
} }
{ const char** fileTable = (const char**)malloc((nbFiles+1) * sizeof(const char*)); { const char** fileTable = (const char**)malloc((nbFiles+1) * sizeof(const char*));
if (!fileTable) { free(buf); *filenameTable = NULL; return 0; } if (!fileTable) { free(buf); *filenameTable = NULL; return 0; }
if (nbFiles == 0) if (nbFiles == 0)
fileTable[0] = buf; fileTable[0] = buf;
+1 -12
View File
@@ -26,7 +26,7 @@
/* ************************************* /* *************************************
* Includes * Includes
***************************************/ ***************************************/
#include "util.h" /* UTIL_GetFileSize */ #include "util.h" /* Compiler options, UTIL_GetFileSize, UTIL_createFileList, UTIL_sleep */
#include <stdlib.h> /* malloc, free */ #include <stdlib.h> /* malloc, free */
#include <string.h> /* memset */ #include <string.h> /* memset */
#include <stdio.h> /* fprintf, fopen, ftello64 */ #include <stdio.h> /* fprintf, fopen, ftello64 */
@@ -37,17 +37,6 @@
#include "xxhash.h" #include "xxhash.h"
/* *************************************
* Compiler specifics
***************************************/
#if defined(_MSC_VER)
#elif defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
/* part of <stdio.h> */
#else
extern int snprintf (char* s, size_t maxlen, const char* format, ...); /* not declared in <stdio.h> when C version < c99 */
#endif
/* ************************************* /* *************************************
* Constants * Constants
+1 -1
View File
@@ -25,7 +25,7 @@
/*-************************************* /*-*************************************
* Includes * Includes
***************************************/ ***************************************/
#include "util.h" /* UTIL_GetFileSize */ #include "util.h" /* Compiler options, UTIL_GetFileSize, UTIL_getTotalFileSize */
#include <stdlib.h> /* malloc, free */ #include <stdlib.h> /* malloc, free */
#include <string.h> /* memset */ #include <string.h> /* memset */
#include <stdio.h> /* fprintf, fopen, ftello64 */ #include <stdio.h> /* fprintf, fopen, ftello64 */
+1 -1
View File
@@ -47,7 +47,7 @@
/*-************************************* /*-*************************************
* Includes * Includes
***************************************/ ***************************************/
#include "util.h" /* UTIL_GetFileSize */ #include "util.h" /* Compiler options, UTIL_GetFileSize */
#include <stdio.h> /* fprintf, fopen, fread, _fileno, stdin, stdout */ #include <stdio.h> /* fprintf, fopen, fread, _fileno, stdin, stdout */
#include <stdlib.h> /* malloc, free */ #include <stdlib.h> /* malloc, free */
#include <string.h> /* strcmp, strlen */ #include <string.h> /* strcmp, strlen */
+5 -5
View File
@@ -25,11 +25,11 @@
/*_************************************ /*_************************************
* Includes * Includes
**************************************/ **************************************/
#include "util.h" /* UTIL_GetFileSize */ #include "util.h" /* Compiler options, UTIL_GetFileSize */
#include <stdlib.h> /* malloc */ #include <stdlib.h> /* malloc */
#include <stdio.h> /* fprintf, fopen, ftello64 */ #include <stdio.h> /* fprintf, fopen, ftello64 */
#include <string.h> /* strcmp */ #include <string.h> /* strcmp */
#include <time.h> /* clock_t, clock, CLOCKS_PER_SEC */ #include <time.h> /* clock_t, clock, CLOCKS_PER_SEC */
#include "mem.h" #include "mem.h"
#include "zstd_static.h" #include "zstd_static.h"
+1 -1
View File
@@ -34,7 +34,7 @@
/*-************************************ /*-************************************
* Dependencies * Dependencies
**************************************/ **************************************/
#include "util.h" /* UTIL_GetFileSize */ #include "util.h" /* Compiler options, UTIL_GetFileSize */
#include <stdlib.h> /* malloc */ #include <stdlib.h> /* malloc */
#include <stdio.h> /* fprintf, fopen, ftello64 */ #include <stdio.h> /* fprintf, fopen, ftello64 */
#include <string.h> /* strcmp */ #include <string.h> /* strcmp */