commit 23190aa60fadf7c749e5262174c36d5ad487308f
parent 01e6d435feb885e7efe819b3f3c6089c6620de20
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Thu, 21 Mar 2019 19:17:03 +0100
tweaks: make an assignment only when the option is valid, like elsewhere
Diffstat:
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/src/rcfile.c b/src/rcfile.c
@@ -1128,19 +1128,17 @@ void parse_rcfile(FILE *rcstream, bool syntax_only)
free(option);
}
if (strcasecmp(rcopts[i].name, "matchbrackets") == 0) {
- matchbrackets = option;
- if (has_blank_char(matchbrackets)) {
+ if (has_blank_char(option)) {
rcfile_error(N_("Non-blank characters required"));
- free(matchbrackets);
- matchbrackets = NULL;
- }
+ free(option);
+ } else
+ matchbrackets = option;
} else if (strcasecmp(rcopts[i].name, "whitespace") == 0) {
- whitespace = option;
- if (mbstrlen(whitespace) != 2 || strlenpt(whitespace) != 2) {
+ if (mbstrlen(option) != 2 || strlenpt(option) != 2) {
rcfile_error(N_("Two single-column characters required"));
- free(whitespace);
- whitespace = NULL;
+ free(option);
} else {
+ whitespace = option;
whitespace_len[0] = parse_mbchar(whitespace, NULL, NULL);
whitespace_len[1] = parse_mbchar(whitespace +
whitespace_len[0], NULL, NULL);