mirror of
https://github.com/facebook/zstd.git
synced 2025-07-29 11:21:22 +03:00
fixing some warning
This commit is contained in:
@ -261,7 +261,7 @@ UTIL_createFileNamesTable_fromFileName(const char* inputFileName) {
|
||||
}
|
||||
nbFiles = ret_nbFiles;
|
||||
|
||||
filesTable = (FileNamesTable*) malloc(sizeof(FileNamesTable));
|
||||
filesTable = UTIL_createFileNamesTable(NULL, NULL, 0);
|
||||
if(!filesTable) {
|
||||
free(buf);
|
||||
UTIL_DISPLAYLEVEL(1, "[ERROR][UTIL_readFileNamesTableFromFile] Can't create table for files.\n");
|
||||
@ -290,6 +290,18 @@ UTIL_createFileNamesTable_fromFileName(const char* inputFileName) {
|
||||
return filesTable;
|
||||
}
|
||||
|
||||
FileNamesTable*
|
||||
UTIL_createFileNamesTable(const char** filenames, char* buf, size_t tableSize){
|
||||
FileNamesTable* table = (FileNamesTable*) malloc(sizeof(FileNamesTable));
|
||||
if(!table) {
|
||||
return NULL;
|
||||
}
|
||||
table->fileNames = filenames;
|
||||
table->buf = buf;
|
||||
table->tableSize = tableSize;
|
||||
return table;
|
||||
}
|
||||
|
||||
void UTIL_freeFileNamesTable(FileNamesTable* table) {
|
||||
if(table) {
|
||||
if(table->fileNames) {
|
||||
@ -324,7 +336,7 @@ UTIL_concatenateTwoTables(FileNamesTable* table1, FileNamesTable* table2) {
|
||||
char* buf = NULL;
|
||||
|
||||
|
||||
newTable = (FileNamesTable*) malloc(sizeof(FileNamesTable));
|
||||
newTable = UTIL_createFileNamesTable(NULL, NULL, 0);
|
||||
|
||||
if(!newTable) {
|
||||
UTIL_DISPLAYLEVEL(1, "[ERROR][UTIL_concatenateTwoTables] Can't create new table for concatenation output.\n");
|
||||
|
@ -151,8 +151,8 @@ int UTIL_readLineFromFile(char* buf, size_t len, FILE* file);
|
||||
/*Note: tableSize is denotes the total capacity of table*/
|
||||
typedef struct
|
||||
{
|
||||
const char** fileNames = NULL;
|
||||
char* buf = NULL;
|
||||
const char** fileNames;
|
||||
char* buf;
|
||||
size_t tableSize;
|
||||
} FileNamesTable;
|
||||
|
||||
@ -163,6 +163,16 @@ typedef struct
|
||||
*/
|
||||
FileNamesTable* UTIL_createFileNamesTable_fromFileName(const char* inputFileName);
|
||||
|
||||
|
||||
/*! UTIL_freeFileNamesTable(const char** filenames, char* buf, size_t tableSize) :
|
||||
* This function takes an buffered based filename, buf and tableSize to create its object.
|
||||
* @return : FileNamesTable*
|
||||
*/
|
||||
|
||||
FileNamesTable*
|
||||
UTIL_createFileNamesTable(const char** filenames, char* buf, size_t tableSize);
|
||||
|
||||
|
||||
/*! UTIL_freeFileNamesTable(FileNamesTable* table) :
|
||||
* This function takes an buffered based table and frees it.
|
||||
* @return : void.
|
||||
|
@ -818,17 +818,13 @@ int main(int argCount, const char* argv[])
|
||||
|
||||
filenameTable[filenameIdx] = NULL; // marking end of table
|
||||
|
||||
curTable = (FileNamesTable*) malloc(sizeof(FileNamesTable));
|
||||
curTable = UTIL_createFileNamesTable(filenameTable, tableBuf, filenameTableSize);
|
||||
|
||||
if(!curTable) {
|
||||
UTIL_freeFileNamesTable(extendedTable);
|
||||
CLEAN_RETURN(badusage(programName));
|
||||
}
|
||||
|
||||
curTable->fileNames = filenameTable;
|
||||
curTable->tableSize = filenameTableSize;
|
||||
curTable->buf = tableBuf;
|
||||
|
||||
concatenatedTables = UTIL_concatenateTwoTables(curTable, extendedTable);
|
||||
if(!concatenatedTables) {
|
||||
UTIL_freeFileNamesTable(curTable);
|
||||
|
Reference in New Issue
Block a user