]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
changed name from createX to assembleX
authorYann Collet <cyan@fb.com>
Mon, 25 Nov 2019 23:34:55 +0000 (15:34 -0800)
committerYann Collet <cyan@fb.com>
Mon, 25 Nov 2019 23:34:55 +0000 (15:34 -0800)
shows that the resulting object just takes ownership of provided buffer.

contrib/largeNbDicts/largeNbDicts.c
programs/util.c
programs/util.h

index 0038e2041f684088f1d55066ae0da5bf53c033a1..121cf2f9916c12949117fe9c412beb4164200998 100644 (file)
@@ -770,7 +770,7 @@ int main (int argc, const char** argv)
 
     if (argc < 2) return bad_usage(exeName);
 
-    const char** nameTable = (const char**)malloc(argc * sizeof(const char*));
+    const char** nameTable = (const char**)malloc((size_t)argc * sizeof(const char*));
     assert(nameTable != NULL);
     unsigned nameIdx = 0;
 
@@ -805,7 +805,7 @@ int main (int argc, const char** argv)
 #endif
         filenameTable = UTIL_createExpandedFNT(nameTable, nameIdx, 1 /* follow_links */);
     } else {
-        filenameTable = UTIL_createFileNamesTable(nameTable, nameIdx, NULL);
+        filenameTable = UTIL_assembleFileNamesTable(nameTable, nameIdx, NULL);
         nameTable = NULL;  /* UTIL_createFileNamesTable() takes ownership of nameTable */
     }
 
index 7839799da5b00bb7afc9d11ff29c747e5510f55d..ef1ee7b15b4584725abe86c5daca64aaa8162b4e 100644 (file)
@@ -323,12 +323,12 @@ UTIL_createFileNamesTable_fromFileName(const char* inputFileName)
         }   }
         assert(pos <= bufSize);
 
-        return UTIL_createFileNamesTable(filenamesTable, nbFiles, buf);
+        return UTIL_assembleFileNamesTable(filenamesTable, nbFiles, buf);
     }
 }
 
 FileNamesTable*
-UTIL_createFileNamesTable(const char** filenames, size_t tableSize, char* buf)
+UTIL_assembleFileNamesTable(const char** filenames, size_t tableSize, char* buf)
 {
     FileNamesTable* const table = (FileNamesTable*) malloc(sizeof(*table));
     if(!table) return NULL;
@@ -352,7 +352,7 @@ FileNamesTable* UTIL_allocateFileNamesTable(size_t tableSize)
     const char** const fnTable = (const char**)malloc(tableSize * sizeof(*fnTable));
     FileNamesTable* fnt;
     if (fnTable==NULL) return NULL;
-    fnt = UTIL_createFileNamesTable(fnTable, tableSize, NULL);
+    fnt = UTIL_assembleFileNamesTable(fnTable, tableSize, NULL);
     fnt->tableSize = 0;   /* the table is empty */
     return fnt;
 }
@@ -381,7 +381,7 @@ UTIL_mergeFileNamesTable(FileNamesTable* table1, FileNamesTable* table2)
     size_t newTotalTableSize;
     char* buf;
 
-    FileNamesTable* const newTable = UTIL_createFileNamesTable(NULL, 0, NULL);
+    FileNamesTable* const newTable = UTIL_assembleFileNamesTable(NULL, 0, NULL);
     CONTROL( newTable != NULL );
 
     newTotalTableSize = getTotalTableSize(table1) + getTotalTableSize(table2);
@@ -630,7 +630,7 @@ UTIL_createExpandedFNT(const char** inputNames, size_t nbIfns, int followLinks)
             pos += strlen(fileNamesTable[ifnNb]) + 1;
         }
 
-        return UTIL_createFileNamesTable(fileNamesTable, nbFiles, buf);
+        return UTIL_assembleFileNamesTable(fileNamesTable, nbFiles, buf);
     }
 }
 
@@ -648,7 +648,7 @@ FileNamesTable* UTIL_createFNT_fromROTable(const char** filenames, size_t nbFile
     const char** const newFNTable = (const char**)malloc(sizeof_FNTable);
     if (newFNTable==NULL) return NULL;
     memcpy((void*)newFNTable, filenames, sizeof_FNTable);  /* void* : mitigate a Visual compiler bug or limitation */
-    return UTIL_createFileNamesTable(newFNTable, nbFilenames, NULL);
+    return UTIL_assembleFileNamesTable(newFNTable, nbFilenames, NULL);
 }
 
 
index 91a449a679a5df57168f7e0f43d28c1e28db7aa2..14e5b4948a42da2eec21ffbb00d5dea51f2c92d0 100644 (file)
@@ -175,13 +175,13 @@ typedef struct
 FileNamesTable*
 UTIL_createFileNamesTable_fromFileName(const char* inputFileName);
 
-/*! UTIL_createFileNamesTable() :
+/*! UTIL_assembleFileNamesTable() :
  *  This function takes ownership of its arguments, @filenames and @buf,
  *  and store them inside the created object.
  * @return : FileNamesTable*, or NULL, if allocation fails.
  */
 FileNamesTable*
-UTIL_createFileNamesTable(const char** filenames, size_t tableSize, char* buf);
+UTIL_assembleFileNamesTable(const char** filenames, size_t tableSize, char* buf);
 
 /*! UTIL_freeFileNamesTable() :
  *  This function is compatible with NULL argument and never fails.