tweaks: change a 'do' to a 'while', and return early to elide an 'if'

master
Benno Schulenberg 2018-01-19 18:05:24 +01:00
parent a99158c7c0
commit 37e9ada964
1 changed files with 11 additions and 13 deletions

View File

@ -188,27 +188,25 @@ char *parse_argument(char *ptr)
const char *ptr_save = ptr;
char *last_quote = NULL;
assert(ptr != NULL);
if (*ptr != '"')
return parse_next_word(ptr);
do {
ptr++;
if (*ptr == '"')
while (*ptr != '\0') {
if (*++ptr == '"')
last_quote = ptr;
} while (*ptr != '\0');
}
if (last_quote == NULL) {
rcfile_error(N_("Argument '%s' has an unterminated \""), ptr_save);
ptr = NULL;
} else {
return NULL;
}
*last_quote = '\0';
ptr = last_quote + 1;
}
if (ptr != NULL)
while (isblank((unsigned char)*ptr))
ptr++;
return ptr;
}