From f62470c650e0db9536f32b9e1ecbe7d25f759031 Mon Sep 17 00:00:00 2001 From: Nguyễn Thái Ngọc Duy Date: Sun, 27 Jan 2019 07:35:25 +0700 Subject: parse-options: add OPT_BITOP() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is needed for diff_opt_parse() where we do value = (value & ~mask) | some_more; Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- parse-options.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'parse-options.c') diff --git a/parse-options.c b/parse-options.c index 779034e1fd..62d94ca2e0 100644 --- a/parse-options.c +++ b/parse-options.c @@ -109,6 +109,13 @@ static int get_value(struct parse_opt_ctx_t *p, *(int *)opt->value &= ~opt->defval; return 0; + case OPTION_BITOP: + if (unset) + BUG("BITOP can't have unset form"); + *(int *)opt->value &= ~opt->extra; + *(int *)opt->value |= opt->defval; + return 0; + case OPTION_COUNTUP: if (*(int *)opt->value < 0) *(int *)opt->value = 0; -- cgit v1.3-5-g9baa