nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 37e9ada9642d4b95e97fad60c20e9db92cb51ad0
parent a99158c7c01861c79d72ab553da528c8b74d41b3
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Fri, 19 Jan 2018 18:05:24 +0100

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

Diffstat:
Msrc/rcfile.c | 24+++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/src/rcfile.c b/src/rcfile.c @@ -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 { - *last_quote = '\0'; - ptr = last_quote + 1; + return NULL; } - if (ptr != NULL) - while (isblank((unsigned char)*ptr)) - ptr++; + + *last_quote = '\0'; + ptr = last_quote + 1; + + while (isblank((unsigned char)*ptr)) + ptr++; + return ptr; }