From: Michael Haggerty <mhagger@xxxxxxxxxxxx> Signed-off-by: Michael Haggerty <mhagger@xxxxxxxxxxxx> --- refs.c | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/refs.c b/refs.c index 30ff9b8..54f65e3 100644 --- a/refs.c +++ b/refs.c @@ -199,8 +199,11 @@ static void free_ref_entry(struct ref_entry *entry) * stored directly in dir; no recursion into subdirectories is * done. */ -static void add_entry_to_dir(struct ref_dir *dir, struct ref_entry *entry) +static void add_entry(struct ref_entry *direntry, struct ref_entry *entry) { + struct ref_dir *dir; + assert(direntry->flag & REF_DIR); + dir = &direntry->u.subdir; ALLOC_GROW(dir->entries, dir->nr + 1, dir->alloc); dir->entries[dir->nr++] = entry; } @@ -310,7 +313,7 @@ static struct ref_entry *find_containing_direntry(struct ref_entry *direntry, break; } entry = create_dir_entry(refname_copy); - add_entry_to_dir(&direntry->u.subdir, entry); + add_entry(direntry, entry); } slash[1] = tmp; assert(entry->flag & REF_DIR); @@ -348,7 +351,7 @@ static int add_ref(struct ref_entry *direntry, struct ref_entry *ref) direntry = find_containing_direntry(direntry, ref->name, 1); if (!direntry) return -1; - add_entry_to_dir(&direntry->u.subdir, ref); + add_entry(direntry, ref); return 0; } @@ -812,8 +815,7 @@ static void get_ref_dir(struct ref_cache *refs, const char *dirname) hashclr(sha1); flag |= REF_ISBROKEN; } - add_entry_to_dir(&direntry->u.subdir, - create_ref_entry(refname, sha1, flag, 1)); + add_entry(direntry, create_ref_entry(refname, sha1, flag, 1)); } free(refname); closedir(d); -- 1.7.8 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html