diff options
author | Junio C Hamano <gitster@pobox.com> | 2025-04-24 17:25:33 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2025-04-24 17:25:34 -0700 |
commit | 2bc5414c411aab33c155b1070b7764ef6a49a02d (patch) | |
tree | 3f2b065f7c9c54838ab380ba5d16e7a9f742344b /diff.c | |
parent | 68e5342e191a2de216dbf712a6dbfa49282429c4 (diff) | |
parent | 791aeddfa2fdb9e830e24c50c97bb5e8bf3613e6 (diff) |
Merge branch 'ps/parse-options-integers'
Update parse-options API to catch mistakes to pass address of an
integral variable of a wrong type/size.
* ps/parse-options-integers:
parse-options: detect mismatches in integer signedness
parse-options: introduce precision handling for `OPTION_UNSIGNED`
parse-options: introduce precision handling for `OPTION_INTEGER`
parse-options: rename `OPT_MAGNITUDE()` to `OPT_UNSIGNED()`
parse-options: support unit factors in `OPT_INTEGER()`
global: use designated initializers for options
parse: fix off-by-one for minimum signed values
Diffstat (limited to 'diff.c')
-rw-r--r-- | diff.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -5894,10 +5894,15 @@ struct option *add_diff_options(const struct option *opts, OPT_CALLBACK_F(0, "diff-filter", options, N_("[(A|C|D|M|R|T|U|X|B)...[*]]"), N_("select files by diff type"), PARSE_OPT_NONEG, diff_opt_diff_filter), - { OPTION_CALLBACK, 0, "output", options, N_("<file>"), - N_("output to a specific file"), - PARSE_OPT_NONEG, NULL, 0, diff_opt_output }, - + { + .type = OPTION_CALLBACK, + .long_name = "output", + .value = options, + .argh = N_("<file>"), + .help = N_("output to a specific file"), + .flags = PARSE_OPT_NONEG, + .ll_callback = diff_opt_output, + }, OPT_END() }; |