git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] connect: use strcmp() for string comparison
@ 2015-02-21 19:49 René Scharfe
  0 siblings, 0 replies; only message in thread
From: René Scharfe @ 2015-02-21 19:49 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Junio C Hamano

Get rid of magic string length constants and simply compare the strings
using strcmp().  This makes the intent of the code a bit clearer.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
---
 connect.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/connect.c b/connect.c
index 062e133..2a5c400 100644
--- a/connect.c
+++ b/connect.c
@@ -157,8 +157,7 @@ struct ref **get_remote_heads(int in, char *src_buf, size_t src_len,
 			server_capabilities = xstrdup(name + name_len + 1);
 		}
 
-		if (extra_have &&
-		    name_len == 5 && !memcmp(".have", name, 5)) {
+		if (extra_have && !strcmp(name, ".have")) {
 			sha1_array_append(extra_have, old_sha1);
 			continue;
 		}
-- 
2.3.0

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-02-21 19:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-21 19:49 [PATCH] connect: use strcmp() for string comparison René Scharfe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).