mirror of
https://github.com/facebook/zstd.git
synced 2025-10-20 00:04:34 -04:00
fixing newTable issues and some warnings
This commit is contained in:
parent
639bb46954
commit
0e6a73b148
@ -237,9 +237,8 @@ UTIL_createFileNamesTable_fromFileName(const char* inputFileName) {
|
|||||||
char* buf = NULL;
|
char* buf = NULL;
|
||||||
size_t i = 0, pos = 0;
|
size_t i = 0, pos = 0;
|
||||||
|
|
||||||
FileNamesTable* filesTable = (FileNamesTable*) malloc(sizeof(FileNamesTable));
|
FileNamesTable* filesTable = NULL;
|
||||||
|
|
||||||
UTIL_DISPLAY("file check\n");
|
|
||||||
if(!UTIL_fileExist(inputFileName) || !UTIL_isRegularFile(inputFileName))
|
if(!UTIL_fileExist(inputFileName) || !UTIL_isRegularFile(inputFileName))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -262,7 +261,7 @@ UTIL_createFileNamesTable_fromFileName(const char* inputFileName) {
|
|||||||
}
|
}
|
||||||
nbFiles = ret_nbFiles;
|
nbFiles = ret_nbFiles;
|
||||||
|
|
||||||
|
filesTable = (FileNamesTable*) malloc(sizeof(FileNamesTable));
|
||||||
if(!filesTable) {
|
if(!filesTable) {
|
||||||
free(buf);
|
free(buf);
|
||||||
UTIL_DISPLAYLEVEL(1, "[ERROR][UTIL_readFileNamesTableFromFile] Can't create table for files.\n");
|
UTIL_DISPLAYLEVEL(1, "[ERROR][UTIL_readFileNamesTableFromFile] Can't create table for files.\n");
|
||||||
@ -294,10 +293,13 @@ UTIL_createFileNamesTable_fromFileName(const char* inputFileName) {
|
|||||||
void UTIL_freeFileNamesTable(FileNamesTable* table) {
|
void UTIL_freeFileNamesTable(FileNamesTable* table) {
|
||||||
if(table) {
|
if(table) {
|
||||||
if(table->fileNames) {
|
if(table->fileNames) {
|
||||||
if(table->buf)
|
|
||||||
free(table->buf);
|
|
||||||
free(table->fileNames);
|
free(table->fileNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(table->buf) {
|
||||||
|
free(table->buf);
|
||||||
|
}
|
||||||
|
|
||||||
free(table);
|
free(table);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -317,11 +319,13 @@ UTIL_concatenateTwoTables(FileNamesTable* table1, FileNamesTable* table2) {
|
|||||||
size_t i = 0, pos = 0;
|
size_t i = 0, pos = 0;
|
||||||
size_t newTotalTableSize = 0;
|
size_t newTotalTableSize = 0;
|
||||||
|
|
||||||
FileNamesTable* newTable = (FileNamesTable*) malloc(sizeof(FileNamesTable));
|
FileNamesTable* newTable = NULL;
|
||||||
|
|
||||||
char* buf = NULL;
|
char* buf = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
newTable = (FileNamesTable*) malloc(sizeof(FileNamesTable));
|
||||||
|
|
||||||
if(!newTable) {
|
if(!newTable) {
|
||||||
UTIL_DISPLAYLEVEL(1, "[ERROR][UTIL_concatenateTwoTables] Can't create new table for concatenation output.\n");
|
UTIL_DISPLAYLEVEL(1, "[ERROR][UTIL_concatenateTwoTables] Can't create new table for concatenation output.\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -372,8 +376,6 @@ UTIL_concatenateTwoTables(FileNamesTable* table1, FileNamesTable* table2) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(newTableIdx == newTable->tableSize || newTable->fileNames[newTableIdx] == NULL);
|
|
||||||
|
|
||||||
newTable->buf = buf;
|
newTable->buf = buf;
|
||||||
|
|
||||||
UTIL_freeFileNamesTable(table1);
|
UTIL_freeFileNamesTable(table1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user