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 <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Michael Haggerty committed Jul 28, 2015 at 23:08 UTC 5f65499fa281748421f2ae65cd794533ada4b4de
1 file changed +2 -2
builtin/fetch.c
+2 -2
@@ -976,13 +976,13 @@ static int get_remote_group(const char *key, const char *value, void *priv)
976 if (starts_with(key, "remotes.") &&
977 !strcmp(key + 8, g->name)) {
978 /* split list by white space */
979 - size_t wordlen = strcspn(value, " \t\n");
979 while (*value) {
980 + size_t wordlen = strcspn(value, " \t\n");
981 +
982 if (wordlen >= 1)
983 string_list_append(g->list,
984 xstrndup(value, wordlen));
985 value += wordlen + (value[wordlen] != '\0');
985 - wordlen = strcspn(value, " \t\n");
986 }
987 }
988