summaryrefslogtreecommitdiff
path: root/Documentation/technical/api-parse-options.adoc
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-04-24 17:25:33 -0700
committerJunio C Hamano <gitster@pobox.com>2025-04-24 17:25:34 -0700
commit2bc5414c411aab33c155b1070b7764ef6a49a02d (patch)
tree3f2b065f7c9c54838ab380ba5d16e7a9f742344b /Documentation/technical/api-parse-options.adoc
parent68e5342e191a2de216dbf712a6dbfa49282429c4 (diff)
parent791aeddfa2fdb9e830e24c50c97bb5e8bf3613e6 (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 'Documentation/technical/api-parse-options.adoc')
-rw-r--r--Documentation/technical/api-parse-options.adoc10
1 files changed, 6 insertions, 4 deletions
diff --git a/Documentation/technical/api-parse-options.adoc b/Documentation/technical/api-parse-options.adoc
index 61fa6ee167..880eb94642 100644
--- a/Documentation/technical/api-parse-options.adoc
+++ b/Documentation/technical/api-parse-options.adoc
@@ -211,11 +211,13 @@ There are some macros to easily define options:
Use of `--no-option` will clear the list of preceding values.
`OPT_INTEGER(short, long, &int_var, description)`::
- Introduce an option with integer argument.
- The integer is put into `int_var`.
+ Introduce an option with integer argument. The argument must be a
+ integer and may include a suffix of 'k', 'm' or 'g' to
+ scale the provided value by 1024, 1024^2 or 1024^3 respectively.
+ The scaled value is put into `int_var`.
-`OPT_MAGNITUDE(short, long, &unsigned_long_var, description)`::
- Introduce an option with a size argument. The argument must be a
+`OPT_UNSIGNED(short, long, &unsigned_long_var, description)`::
+ Introduce an option with an unsigned integer argument. The argument must be a
non-negative integer and may include a suffix of 'k', 'm' or 'g' to
scale the provided value by 1024, 1024^2 or 1024^3 respectively.
The scaled value is put into `unsigned_long_var`.