diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2019-01-27 03:35:25 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-01-28 03:28:18 +0300 |
commit | f62470c650e0db9536f32b9e1ecbe7d25f759031 (patch) | |
tree | a2173e2a99bc2deec3126be06a440b0071bd9d96 /parse-options.h | |
parent | baa4adc66aefe2c3cc15b573b8a19dec786a1641 (diff) |
parse-options: add OPT_BITOP()
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 <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'parse-options.h')
-rw-r--r-- | parse-options.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/parse-options.h b/parse-options.h index d663b83973..c97324f576 100644 --- a/parse-options.h +++ b/parse-options.h @@ -10,6 +10,7 @@ enum parse_opt_type { /* options with no arguments */ OPTION_BIT, OPTION_NEGBIT, + OPTION_BITOP, OPTION_COUNTUP, OPTION_SET_INT, OPTION_CMDMODE, @@ -118,6 +119,7 @@ struct option { int flags; parse_opt_cb *callback; intptr_t defval; + intptr_t extra; }; #define OPT_BIT_F(s, l, v, h, b, f) { OPTION_BIT, (s), (l), (v), NULL, (h), \ @@ -133,6 +135,9 @@ struct option { (h), PARSE_OPT_NOARG} #define OPT_GROUP(h) { OPTION_GROUP, 0, NULL, NULL, NULL, (h) } #define OPT_BIT(s, l, v, h, b) OPT_BIT_F(s, l, v, h, b, 0) +#define OPT_BITOP(s, l, v, h, set, clear) { OPTION_BITOP, (s), (l), (v), NULL, (h), \ + PARSE_OPT_NOARG|PARSE_OPT_NONEG, NULL, \ + (set), (clear) } #define OPT_NEGBIT(s, l, v, h, b) { OPTION_NEGBIT, (s), (l), (v), NULL, \ (h), PARSE_OPT_NOARG, NULL, (b) } #define OPT_COUNTUP(s, l, v, h) OPT_COUNTUP_F(s, l, v, h, 0) |