From b55923f5ecb7543ab033030aed50b06e5b6a6467 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Thu, 13 Jun 2019 19:55:43 +0200 Subject: [PATCH] tweaks: reshuffle some lines, to group things more sensibly --- src/rcfile.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/rcfile.c b/src/rcfile.c index 48fb5d97..c8da6d21 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -1151,25 +1151,23 @@ void parse_rcfile(FILE *rcstream, bool syntax_only, bool headers_only) continue; } - /* First handle unsetting. */ - if (set == -1) { - if (rcopts[i].flag != 0) - UNSET(rcopts[i].flag); + /* If the option has a flag, set it or unset it, as requested. */ + if (rcopts[i].flag) { + if (set == 1) + SET(rcopts[i].flag); else - rcfile_error(N_("Cannot unset option \"%s\""), rcopts[i].name); + UNSET(rcopts[i].flag); continue; } - /* If the option has a flag, it doesn't take an argument. */ - if (rcopts[i].flag != 0) { - SET(rcopts[i].flag); + /* An option that takes an argument cannot be unset. */ + if (set == -1) { + rcfile_error(N_("Cannot unset option \"%s\""), rcopts[i].name); continue; } - /* The option doesn't have a flag, so it takes an argument. */ if (*ptr == '\0') { - rcfile_error(N_("Option \"%s\" requires an argument"), - rcopts[i].name); + rcfile_error(N_("Option \"%s\" requires an argument"), rcopts[i].name); continue; }