From: Michael Haggerty <mhagger@xxxxxxxxxxxx> And rename function add_entry_to_dir() -> add_entry(). Signed-off-by: Michael Haggerty <mhagger@xxxxxxxxxxxx> --- refs.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/refs.c b/refs.c index 07856fb..a794d3a 100644 --- a/refs.c +++ b/refs.c @@ -200,12 +200,14 @@ static void free_ref_entry(struct ref_entry *entry) } /* - * Add a ref_entry to the end of dir (unsorted). Entry is always - * stored directly in dir; no recursion into subdirectories is - * done. + * Add entry to the end of direntry, unsorted. entry is always stored + * directly in direntry; 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; } @@ -295,7 +297,7 @@ static struct ref_entry *search_for_subdir(struct ref_entry *direntry, if (!mkdir) return NULL; entry = create_dir_entry(subdirname); - add_entry_to_dir(&direntry->u.subdir, entry); + add_entry(direntry, entry); } assert(entry->flag & REF_DIR); return entry; @@ -356,7 +358,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; } @@ -830,8 +832,8 @@ static void get_ref_dir(struct ref_cache *refs, struct ref_entry *direntry) hashclr(sha1); flag |= REF_ISBROKEN; } - add_entry_to_dir(&direntry->u.subdir, - create_ref_entry(refname.buf, sha1, flag, 1)); + add_entry(direntry, + create_ref_entry(refname.buf, sha1, flag, 1)); } strbuf_setlen(&refname, dirnamelen); } -- 1.7.10 -- 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