- llmosrt.c --> llmsort.c as it should be named.
- Remove useless free(...) calls and a temp variable.

svn path=/trunk/; revision=66080
This commit is contained in:
Hermès Bélusca-Maïto 2015-01-23 21:38:15 +00:00
parent 44613092ba
commit ea6251ad97
4 changed files with 4 additions and 7 deletions

View file

@ -1,2 +1,2 @@
add_executable(cdmake cdmake.c dirhash.c llmosrt.c) add_executable(cdmake cdmake.c dirhash.c llmsort.c)

View file

@ -653,7 +653,7 @@ new_directory_record(struct _finddata_t *f,
{ {
PDIR_RECORD d; PDIR_RECORD d;
d = calloc(1, sizeof(DIR_RECORD)); d = calloc(1, sizeof(*d));
if (d == NULL) if (d == NULL)
error_exit("Insufficient memory"); error_exit("Insufficient memory");
d->next_in_memory = root.next_in_memory; d->next_in_memory = root.next_in_memory;
@ -687,7 +687,7 @@ new_directory_record(struct dirent *entry,
char *n; char *n;
*/ */
d = calloc(1, sizeof(DIR_RECORD)); d = calloc(1, sizeof(*d));
if (d == NULL) if (d == NULL)
error_exit("Insufficient memory"); error_exit("Insufficient memory");
d->next_in_memory = root.next_in_memory; d->next_in_memory = root.next_in_memory;

View file

@ -39,7 +39,6 @@ chop_dirname(const char *name, char **dirname)
last_slash = strrchr(name, '\\'); last_slash = strrchr(name, '\\');
if (!last_slash) if (!last_slash)
{ {
free(*dirname);
*dirname = malloc(1); *dirname = malloc(1);
**dirname = 0; **dirname = 0;
} }
@ -48,7 +47,6 @@ chop_dirname(const char *name, char **dirname)
char *newdata = malloc(last_slash - name + 1); char *newdata = malloc(last_slash - name + 1);
memcpy(newdata, name, last_slash - name); memcpy(newdata, name, last_slash - name);
newdata[last_slash - name] = 0; newdata[last_slash - name] = 0;
free(*dirname);
*dirname = newdata; *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_file *tf;
struct target_dir_entry *de; struct target_dir_entry *de;
const char *filename = chop_filename(target);
char *targetdir = NULL; char *targetdir = NULL;
char *targetnorm; char *targetnorm;
chop_dirname(target, &targetdir); 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; tf->next = de->head;
de->head = tf; de->head = tf;
tf->source_name = strdup(source); tf->source_name = strdup(source);
tf->target_name = strdup(filename); tf->target_name = strdup(chop_filename(target));
} }
static struct target_dir_entry * static struct target_dir_entry *