- Disable unused dir_hash_next_dir function and corresponding target_dir_traversal structure definition.
- Be really sure de->head and de->child are initialized at NULL.
- Remove extra parentheses and unused variable.

svn path=/trunk/; revision=66083
This commit is contained in:
Hermès Bélusca-Maïto 2015-01-24 00:15:08 +00:00
parent 8ee4a20157
commit 66cc347765
2 changed files with 7 additions and 2 deletions

View file

@ -138,12 +138,14 @@ dir_hash_create_dir(struct target_dir_hash *dh, const char *casename, const char
hashcode = djb_hash(targetnorm); hashcode = djb_hash(targetnorm);
de = calloc(1, sizeof(*de)); de = calloc(1, sizeof(*de));
de->parent = parent_de; de->parent = parent_de;
de->head = NULL;
de->child = NULL;
de->normalized_name = strdup(targetnorm); de->normalized_name = strdup(targetnorm);
de->case_name = strdup(chop_filename(casename)); de->case_name = strdup(chop_filename(casename));
de->next = parent_de->child; de->next = parent_de->child;
parent_de->child = de; parent_de->child = de;
ent = &dh->buckets[hashcode % NUM_DIR_HASH_BUCKETS]; ent = &dh->buckets[hashcode % NUM_DIR_HASH_BUCKETS];
while ((*ent)) while (*ent)
{ {
ent = &(*ent)->next; ent = &(*ent)->next;
} }
@ -170,6 +172,7 @@ void dir_hash_add_file(struct target_dir_hash *dh, const char *source, const cha
tf->target_name = strdup(chop_filename(target)); tf->target_name = strdup(chop_filename(target));
} }
#if 0
static struct target_dir_entry * static struct target_dir_entry *
dir_hash_next_dir(struct target_dir_hash *dh, struct target_dir_traversal *t) dir_hash_next_dir(struct target_dir_hash *dh, struct target_dir_traversal *t)
{ {
@ -200,13 +203,13 @@ dir_hash_next_dir(struct target_dir_hash *dh, struct target_dir_traversal *t)
return t->it; return t->it;
} }
} }
#endif
static void static void
dir_hash_destroy_dir(struct target_dir_hash *dh, struct target_dir_entry *de) dir_hash_destroy_dir(struct target_dir_hash *dh, struct target_dir_entry *de)
{ {
struct target_file *tf; struct target_file *tf;
struct target_dir_entry *te; struct target_dir_entry *te;
unsigned int hashcode;
while ((te = de->child)) while ((te = de->child))
{ {
de->child = te->next; de->child = te->next;

View file

@ -26,11 +26,13 @@ struct target_dir_hash
struct target_dir_entry root; struct target_dir_entry root;
}; };
#if 0
struct target_dir_traversal struct target_dir_traversal
{ {
struct target_dir_entry *it; struct target_dir_entry *it;
int i; int i;
}; };
#endif
void normalize_dirname(char *filename); void normalize_dirname(char *filename);
void dir_hash_add_file(struct target_dir_hash *dh, const char *source, const char *target); void dir_hash_add_file(struct target_dir_hash *dh, const char *source, const char *target);