1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

config: In redir_set, negate the incoming value.

That is, let the setter function of the underlying option store the
negated value.  Previously, redir_set used to tweak the value of the
option after it has already called the underlying setter.
This commit is contained in:
Kalle Olavi Niemitalo 2008-02-03 14:16:46 +02:00 committed by Kalle Olavi Niemitalo
parent 7cdbc908d8
commit 2dbe6ec34f

View File

@ -148,10 +148,13 @@ redir_set(struct option *opt, unsigned char *str)
if_assert_failed { return ret; }
if (option_types[real->type].set) {
ret = option_types[real->type].set(real, str);
long negated;
if ((opt->flags & OPT_ALIAS_NEGATE) && real->type == OPT_BOOL) {
real->value.number = !real->value.number;
negated = !*(long *) str;
str = (unsigned char *) &negated;
}
ret = option_types[real->type].set(real, str);
}
return ret;