Commit 37e9ada9 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

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

No related merge requests found
Showing with 11 additions and 13 deletions
+11 -13
...@@ -188,27 +188,25 @@ char *parse_argument(char *ptr) ...@@ -188,27 +188,25 @@ char *parse_argument(char *ptr)
const char *ptr_save = ptr; const char *ptr_save = ptr;
char *last_quote = NULL; char *last_quote = NULL;
assert(ptr != NULL);
if (*ptr != '"') if (*ptr != '"')
return parse_next_word(ptr); return parse_next_word(ptr);
do { while (*ptr != '\0') {
ptr++; if (*++ptr == '"')
if (*ptr == '"')
last_quote = ptr; last_quote = ptr;
} while (*ptr != '\0'); }
if (last_quote == NULL) { if (last_quote == NULL) {
rcfile_error(N_("Argument '%s' has an unterminated \""), ptr_save); rcfile_error(N_("Argument '%s' has an unterminated \""), ptr_save);
ptr = NULL; return NULL;
} else {
*last_quote = '\0';
ptr = last_quote + 1;
} }
if (ptr != NULL)
while (isblank((unsigned char)*ptr)) *last_quote = '\0';
ptr++; ptr = last_quote + 1;
while (isblank((unsigned char)*ptr))
ptr++;
return ptr; return ptr;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment