diff options
| author | René Scharfe <l.s.r@web.de> | 2025-07-09 11:45:24 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-07-09 08:39:26 -0700 |
| commit | c898bbc5e4b582c28379bc64b7f9c9ec96106993 (patch) | |
| tree | ddff138bb55adc7225edbf3088667818ac4d33e5 /t/helper/test-parse-options.c | |
| parent | 0d3e045b34f38d23e6160ce8aae363f358bd5cdc (diff) | |
parse-options: add precision handling for OPTION_SET_INT
Similar to 09705696f7 (parse-options: introduce precision handling for
`OPTION_INTEGER`, 2025-04-17) support value variables of different sizes
for OPTION_SET_INT. Do that by requiring their "precision" to be set,
casting their "value" pointer accordingly and checking whether the value
fits.
Factor out the casting code from the part of do_get_value() that handles
OPTION_INTEGER to avoid code duplication. We're going to use it in the
next patches as well.
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/helper/test-parse-options.c')
| -rw-r--r-- | t/helper/test-parse-options.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/t/helper/test-parse-options.c b/t/helper/test-parse-options.c index 1e03ff88f6..2ba2546d70 100644 --- a/t/helper/test-parse-options.c +++ b/t/helper/test-parse-options.c @@ -131,6 +131,7 @@ int cmd__parse_options(int argc, const char **argv) .short_name = 'B', .long_name = "no-fear", .value = &boolean, + .precision = sizeof(boolean), .help = "be brave", .flags = PARSE_OPT_NOARG | PARSE_OPT_NONEG, .defval = 1, |
