Skip to content

Commit

Permalink
connect: use strcmp() for string comparison
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
René Scharfe authored and Junio C Hamano committed Feb 22, 2015
1 parent 3c84ac8 commit 2ae7f90
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,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;
}
Expand Down

0 comments on commit 2ae7f90

Please sign in to comment.