Skip to content

Commit 2ae7f90

Browse files
rscharfegitster
authored andcommitted
connect: use strcmp() for string comparison
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3c84ac8 commit 2ae7f90

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

connect.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,7 @@ struct ref **get_remote_heads(int in, char *src_buf, size_t src_len,
161161
server_capabilities = xstrdup(name + name_len + 1);
162162
}
163163

164-
if (extra_have &&
165-
name_len == 5 && !memcmp(".have", name, 5)) {
164+
if (extra_have && !strcmp(name, ".have")) {
166165
sha1_array_append(extra_have, old_sha1);
167166
continue;
168167
}

0 commit comments

Comments
 (0)