/* Think twice before adding "--nul" synonym to this */
OPT_SET_INT('z', NULL, &state->line_termination,
N_("paths are separated with NUL character"), '\0'),
- OPT_INTEGER('C', NULL, &state->p_context,
- N_("ensure at least <n> lines of context match")),
+ OPT_UNSIGNED('C', NULL, &state->p_context,
+ N_("ensure at least <n> lines of context match")),
OPT_CALLBACK(0, "whitespace", state, N_("action"),
N_("detect new or modified lines that have whitespace errors"),
apply_option_parse_whitespace),
.sparse = 0,
};
struct option options[] = {
- OPT_INTEGER(0, "min-batch-size", &ctx.min_batch_size,
- N_("Minimum number of objects to request at a time")),
+ OPT_UNSIGNED(0, "min-batch-size", &ctx.min_batch_size,
+ N_("Minimum number of objects to request at a time")),
OPT_BOOL(0, "sparse", &ctx.sparse,
N_("Restrict the missing objects to the current sparse-checkout")),
OPT_END(),
struct option options[] = {
OPT_STRING(0, "command", &real_command, N_("name"), N_("lookup config vars")),
OPT_COLUMN(0, "mode", &colopts, N_("layout to use")),
- OPT_INTEGER(0, "raw-mode", &colopts, N_("layout to use")),
+ OPT_UNSIGNED(0, "raw-mode", &colopts, N_("layout to use")),
OPT_INTEGER(0, "width", &copts.width, N_("maximum width")),
OPT_STRING(0, "indent", &copts.indent, N_("string"), N_("padding space on left border")),
OPT_STRING(0, "nl", &copts.nl, N_("string"), N_("padding space on right border")),
OPT_CALLBACK('C', "context", &opt, N_("n"),
N_("show <n> context lines before and after matches"),
context_callback),
- OPT_INTEGER('B', "before-context", &opt.pre_context,
+ OPT_UNSIGNED('B', "before-context", &opt.pre_context,
N_("show <n> context lines before matches")),
- OPT_INTEGER('A', "after-context", &opt.post_context,
+ OPT_UNSIGNED('A', "after-context", &opt.post_context,
N_("show <n> context lines after matches")),
OPT_INTEGER(0, "threads", &num_threads,
N_("use <n> worker threads")),
# define BARF_UNLESS_COPYABLE(dst, src) \
BUILD_ASSERT_OR_ZERO(__builtin_types_compatible_p(__typeof__(*(dst)), \
__typeof__(*(src))))
+
+# define BARF_UNLESS_SIGNED(var) BUILD_ASSERT_OR_ZERO(((__typeof__(var)) -1) < 0)
+# define BARF_UNLESS_UNSIGNED(var) BUILD_ASSERT_OR_ZERO(((__typeof__(var)) -1) > 0)
#else
# define BARF_UNLESS_AN_ARRAY(arr) 0
# define BARF_UNLESS_COPYABLE(dst, src) \
BUILD_ASSERT_OR_ZERO(0 ? ((*(dst) = *(src)), 0) : \
sizeof(*(dst)) == sizeof(*(src)))
+
+# define BARF_UNLESS_SIGNED(var) 0
+# define BARF_UNLESS_UNSIGNED(var) 0
#endif
+
/*
* ARRAY_SIZE - get the number of elements in a visible array
* @x: the array whose size you want.
.type = OPTION_INTEGER, \
.short_name = (s), \
.long_name = (l), \
- .value = (v), \
+ .value = (v) + BARF_UNLESS_SIGNED(*(v)), \
.precision = sizeof(*v), \
.argh = N_("n"), \
.help = (h), \
.type = OPTION_UNSIGNED, \
.short_name = (s), \
.long_name = (l), \
- .value = (v), \
+ .value = (v) + BARF_UNLESS_UNSIGNED(*(v)), \
.precision = sizeof(*v), \
.argh = N_("n"), \
.help = (h), \