1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-04 08:17:17 -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.
(cherry picked from commit 2dbe6ec34f)
This commit is contained in:
Kalle Olavi Niemitalo 2008-02-03 14:16:46 +02:00 committed by Kalle Olavi Niemitalo
parent 77755cf684
commit a1769e2377

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;