[CDMAKE]
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Fri, 23 Jan 2015 21:38:15 +0000 (21:38 +0000)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Fri, 23 Jan 2015 21:38:15 +0000 (21:38 +0000)
- llmosrt.c --> llmsort.c as it should be named.
- Remove useless free(...) calls and a temp variable.

svn path=/trunk/; revision=66080

reactos/tools/cdmake/CMakeLists.txt
reactos/tools/cdmake/cdmake.c
reactos/tools/cdmake/dirhash.c
reactos/tools/cdmake/llmsort.c [moved from reactos/tools/cdmake/llmosrt.c with 100% similarity]

index 3107a63..d2a70e6 100644 (file)
@@ -1,2 +1,2 @@
 
-add_executable(cdmake cdmake.c dirhash.c llmosrt.c)
+add_executable(cdmake cdmake.c dirhash.c llmsort.c)
index 31e0bf5..907289a 100644 (file)
@@ -653,7 +653,7 @@ new_directory_record(struct _finddata_t *f,
 {
     PDIR_RECORD d;
 
-    d = calloc(1, sizeof(DIR_RECORD));
+    d = calloc(1, sizeof(*d));
     if (d == NULL)
         error_exit("Insufficient memory");
     d->next_in_memory = root.next_in_memory;
@@ -687,7 +687,7 @@ new_directory_record(struct dirent *entry,
     char *n;
     */
 
-    d = calloc(1, sizeof(DIR_RECORD));
+    d = calloc(1, sizeof(*d));
     if (d == NULL)
         error_exit("Insufficient memory");
     d->next_in_memory = root.next_in_memory;
index 9718871..4090f5e 100644 (file)
@@ -39,7 +39,6 @@ chop_dirname(const char *name, char **dirname)
         last_slash = strrchr(name, '\\');
     if (!last_slash)
     {
-        free(*dirname);
         *dirname = malloc(1);
         **dirname = 0;
     }
@@ -48,7 +47,6 @@ chop_dirname(const char *name, char **dirname)
         char *newdata = malloc(last_slash - name + 1);
         memcpy(newdata, name, last_slash - name);
         newdata[last_slash - name] = 0;
-        free(*dirname);
         *dirname = newdata;
     }
 }
@@ -157,7 +155,6 @@ void dir_hash_add_file(struct target_dir_hash *dh, const char *source, const cha
 {
     struct target_file *tf;
     struct target_dir_entry *de;
-    const char *filename = chop_filename(target);
     char *targetdir = NULL;
     char *targetnorm;
     chop_dirname(target, &targetdir);
@@ -170,7 +167,7 @@ void dir_hash_add_file(struct target_dir_hash *dh, const char *source, const cha
     tf->next = de->head;
     de->head = tf;
     tf->source_name = strdup(source);
-    tf->target_name = strdup(filename);
+    tf->target_name = strdup(chop_filename(target));
 }
 
 static struct target_dir_entry *