diff options
author | Michael Haggerty <mhagger@alum.mit.edu> | 2011-12-12 06:38:49 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-12-12 09:08:56 -0800 |
commit | e6c23f4562086ecb6092ae5b790f2b1db2cc7f11 (patch) | |
tree | cf7772ffe43e4a7d8f4de3b7523dbf5eb392c261 | |
parent | a5aac50aad29329fc5c416aa4f42c3e7152a6c02 (diff) | |
download | git-e6c23f4562086ecb6092ae5b790f2b1db2cc7f11.tar.gz |
search_ref_dir(): take (ref_entry *) instead of (ref_dir *)
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | refs.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -246,11 +246,14 @@ static void sort_ref_dir(struct ref_dir *dir); * Return the entry with the given refname from the ref_dir * (non-recursively). Return NULL if no such entry is found. */ -static struct ref_entry *search_ref_dir(struct ref_dir *dir, const char *refname) +static struct ref_entry *search_ref_dir(struct ref_entry *direntry, const char *refname) { struct ref_entry *e, **r; int len; + struct ref_dir *dir; + assert(direntry->flag & REF_DIR); + dir = &direntry->u.subdir; if (refname == NULL || !dir->nr) return NULL; @@ -300,7 +303,7 @@ static struct ref_entry *find_containing_direntry(struct ref_entry *direntry, char tmp = slash[1]; struct ref_entry *entry; slash[1] = '\0'; - entry = search_ref_dir(&direntry->u.subdir, refname_copy); + entry = search_ref_dir(direntry, refname_copy); if (!entry) { if (!mkdir) { direntry = NULL; @@ -330,7 +333,7 @@ static struct ref_entry *find_ref(struct ref_entry *direntry, const char *refnam direntry = find_containing_direntry(direntry, refname, 0); if (!direntry) return NULL; - entry = search_ref_dir(&direntry->u.subdir, refname); + entry = search_ref_dir(direntry, refname); return (entry && !(entry->flag & REF_DIR)) ? entry : NULL; } |