Skip to content

Commit 5f65499

Browse files
mhaggergitster
authored andcommitted
get_remote_group(): eliminate superfluous call to strcspn()
There is no need to call it if value is the empty string. This also eliminates code duplication. Signed-off-by: Michael Haggerty <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e286542 commit 5f65499

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

builtin/fetch.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -976,13 +976,13 @@ static int get_remote_group(const char *key, const char *value, void *priv)
976976
if (starts_with(key, "remotes.") &&
977977
!strcmp(key + 8, g->name)) {
978978
/* split list by white space */
979-
size_t wordlen = strcspn(value, " \t\n");
980979
while (*value) {
980+
size_t wordlen = strcspn(value, " \t\n");
981+
981982
if (wordlen >= 1)
982983
string_list_append(g->list,
983984
xstrndup(value, wordlen));
984985
value += wordlen + (value[wordlen] != '\0');
985-
wordlen = strcspn(value, " \t\n");
986986
}
987987
}
988988

0 commit comments

Comments
 (0)