[RFC 2/3] Alternates API: Improve naming

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

 



This should make the API a bit more cohesive.

Signed-off-by: Michael Witten <mfwitten@xxxxxxxxx>
---
 builtin/fetch-pack.c   |    2 +-
 builtin/receive-pack.c |    2 +-
 sha1_file.c            |    6 +++---
 transport.c            |    8 ++++----
 transport.h            |    4 ++--
 5 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/transport.h b/transport.h
index 72a692f..88fa484 100644
--- a/transport.h
+++ b/transport.h
@@ -166,7 +166,7 @@ int transport_refs_pushed(struct ref *ref);
 void transport_print_push_status(const char *dest, struct ref *refs,
 		  int verbose, int porcelain, int *nonfastforward);
 
-typedef void (*alternate_ref_fn)(const struct ref *, void *);
+typedef void (*transport_alt_refs_fn)(const struct ref *, void *);
-extern int refs_from_alternate_cb(struct alternate_object_database *, alternate_ref_fn);
+extern int transport_alt_refs(struct alternate_object_database *, transport_alt_refs_fn);
 
 #endif
diff --git a/transport.c b/transport.c
index c61723f..53d37a9 100644
--- a/transport.c
+++ b/transport.c
@@ -1190,7 +1190,7 @@ literal_copy:
 	return xstrdup(url);
 }
 
-int refs_from_alternate_cb(struct alternate_object_database *e, alternate_ref_fn ref_fn)
+int transport_alt_refs(struct alternate_object_database *d, transport_alt_refs_fn ref_fn)
 {
 	char *other;
 	size_t len;
@@ -1198,9 +1198,9 @@ int refs_from_alternate_cb(struct alternate_object_database *e, alternate_ref_fn
 	struct transport *transport;
 	const struct ref *extra;
 
-	e->name[-1] = '\0';
+	d->name[-1] = '\0';
-	other = xstrdup(real_path(e->base));
+	other = xstrdup(real_path(d->base));
-	e->name[-1] = '/';
+	d->name[-1] = '/';
 	len = strlen(other);
 
 	while (other[len-1] == '/')
diff --git a/sha1_file.c b/sha1_file.c
index e55a496..a6c1f1f 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -390,11 +390,11 @@ void add_to_alternates_file(const char *reference)
 
 void foreach_alt_odb(alt_odb_fn fn)
 {
-	struct alternate_object_database *ent;
+	struct alternate_object_database *d;
 
 	prepare_alt_odb();
-	for (ent = alt_odb_list; ent; ent = ent->next)
+	for (d = alt_odb_list; d; d = d->next)
-		if (fn(ent))
+		if (fn(d))
 			return;
 }
 
diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c
index 62ebdb4..b3a9f74 100644
--- a/builtin/fetch-pack.c
+++ b/builtin/fetch-pack.c
@@ -226,7 +226,7 @@ static void insert_one_alternate_ref(const struct ref *ref, void *unused)
 
 static int alt_odb_callback(struct alternate_object_database *d)
 {
-	return refs_from_alternate_cb(d,insert_one_alternate_ref);
+	return transport_alt_refs(d,insert_one_alternate_ref);
 }
 
 static void insert_alternate_refs(void)
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index 8ef6301..a761332 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -738,7 +738,7 @@ static void add_one_alternate_ref(const struct ref *ref, void *unused)
 
 static int alt_odb_callback(struct alternate_object_database *d)
 {
-	return refs_from_alternate_cb(d,add_one_alternate_ref);
+	return transport_alt_refs(d,add_one_alternate_ref);
 }
 
 static void add_alternate_refs(void)
-- 
1.7.4.18.g68fe8

--
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]