[PATCH 20/30] search_for_subdir(): take (ref_entry *) instead of (ref_dir *)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Michael Haggerty <mhagger@xxxxxxxxxxxx>


Signed-off-by: Michael Haggerty <mhagger@xxxxxxxxxxxx>
---
 refs.c |   24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/refs.c b/refs.c
index bc4a69b..4bea486 100644
--- a/refs.c
+++ b/refs.c
@@ -277,21 +277,22 @@ static struct ref_entry *search_ref_dir(struct ref_dir *dir, const char *refname
 }
 
 /*
- * Search for a directory entry directly within dir (without
- * recursing).  Sort dir if necessary.  subdirname must be a directory
- * name (i.e., end in '/').  If mkdir is set, then create the
- * directory if it is missing; otherwise, return NULL if the desired
- * directory cannot be found.
+ * Search for a directory entry directly within direntry (without
+ * recursing).  Sort direntry if necessary.  subdirname must be a
+ * directory name (i.e., end in '/').  If mkdir is set, then create
+ * the directory if it is missing; otherwise, return NULL if the
+ * desired directory cannot be found.
  */
-static struct ref_entry *search_for_subdir(struct ref_dir *dir,
+static struct ref_entry *search_for_subdir(struct ref_entry *direntry,
 					   const char *subdirname, int mkdir)
 {
-	struct ref_entry *entry = search_ref_dir(dir, subdirname);
+	struct ref_entry *entry = search_ref_dir(&direntry->u.subdir,
+						 subdirname);
 	if (!entry) {
 		if (!mkdir)
 			return NULL;
 		entry = create_dir_entry(subdirname);
-		add_entry_to_dir(dir, entry);
+		add_entry_to_dir(&direntry->u.subdir, entry);
 	}
 	assert(entry->flag & REF_DIR);
 	return entry;
@@ -314,7 +315,7 @@ static struct ref_entry *find_containing_direntry(struct ref_entry *direntry,
 	for (slash = strchr(refname_copy, '/'); slash; slash = strchr(slash + 1, '/')) {
 		char tmp = slash[1];
 		slash[1] = '\0';
-		direntry = search_for_subdir(&direntry->u.subdir, refname_copy, mkdir);
+		direntry = search_for_subdir(direntry, refname_copy, mkdir);
 		slash[1] = tmp;
 		if (!direntry)
 			break;
@@ -812,7 +813,7 @@ static void get_ref_dir(struct ref_cache *refs, struct ref_entry *direntry)
 		} else if (S_ISDIR(st.st_mode)) {
 			strbuf_addch(&refname, '/');
 			get_ref_dir(refs,
-				    search_for_subdir(&direntry->u.subdir,
+				    search_for_subdir(direntry,
 						      refname.buf, 1));
 		} else {
 			if (*refs->name) {
@@ -840,8 +841,7 @@ static struct ref_entry *get_loose_refs(struct ref_cache *refs)
 	if (!refs->loose) {
 		refs->loose = create_dir_entry("");
 		get_ref_dir(refs,
-			    search_for_subdir(&refs->loose->u.subdir,
-					      "refs/", 1));
+			    search_for_subdir(refs->loose, "refs/", 1));
 	}
 	return refs->loose;
 }
-- 
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


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]