parse-options: remove unused OPT_SET_PTR

OPT_SET_PTR was never used since its creation at db7244bd (parse-options new features., 2007-11-07). Signed-off-by: Junio C Hamano <gitster@pobox.com>

Marat Radchenko committed Mar 30, 2014 at 15:08 UTC 20d1c6528c76242581e89c271679d35884d916dc
5 files changed +4 -19
Documentation/technical/api-parse-options.txt
-4
@@ -160,10 +160,6 @@ There are some macros to easily define options:
160 `int_var` is set to `integer` with `--option`, and
161 reset to zero with `--no-option`.
162
163 -`OPT_SET_PTR(short, long, &ptr_var, description, ptr)`::
164 - Introduce a boolean option.
165 - If used, set `ptr_var` to `ptr`.
166 -
163 `OPT_STRING(short, long, &str_var, arg_str, description)`::
164 Introduce an option with string argument.
165 The string argument is put into `str_var`.
parse-options.c
-5
@@ -127,10 +127,6 @@ static int get_value(struct parse_opt_ctx_t *p,
127 *(int *)opt->value = opt->defval;
128 return 0;
129
130 - case OPTION_SET_PTR:
131 - *(void **)opt->value = unset ? NULL : (void *)opt->defval;
132 - return 0;
133 -
130 case OPTION_STRING:
131 if (unset)
132 *(const char **)opt->value = NULL;
@@ -370,7 +366,6 @@ static void parse_options_check(const struct option *opts)
366 case OPTION_BIT:
367 case OPTION_NEGBIT:
368 case OPTION_SET_INT:
373 - case OPTION_SET_PTR:
369 case OPTION_NUMBER:
370 if ((opts->flags & PARSE_OPT_OPTARG) ||
371 !(opts->flags & PARSE_OPT_NOARG))
parse-options.h
+1 -4
@@ -12,7 +12,6 @@ enum parse_opt_type {
12 OPTION_NEGBIT,
13 OPTION_COUNTUP,
14 OPTION_SET_INT,
15 - OPTION_SET_PTR,
15 OPTION_CMDMODE,
16 /* options with arguments (usually) */
17 OPTION_STRING,
@@ -96,7 +95,7 @@ typedef int parse_opt_ll_cb(struct parse_opt_ctx_t *ctx,
95 *
96 * `defval`::
97 * default value to fill (*->value) with for PARSE_OPT_OPTARG.
99 - * OPTION_{BIT,SET_INT,SET_PTR} store the {mask,integer,pointer} to put in
98 + * OPTION_{BIT,SET_INT} store the {mask,integer,pointer} to put in
99 * the value when met.
100 * CALLBACKS can use it like they want.
101 */
@@ -128,8 +127,6 @@ struct option {
127 #define OPT_BOOL(s, l, v, h) OPT_SET_INT(s, l, v, h, 1)
128 #define OPT_HIDDEN_BOOL(s, l, v, h) { OPTION_SET_INT, (s), (l), (v), NULL, \
129 (h), PARSE_OPT_NOARG | PARSE_OPT_HIDDEN, NULL, 1}
131 -#define OPT_SET_PTR(s, l, v, h, p) { OPTION_SET_PTR, (s), (l), (v), NULL, \
132 - (h), PARSE_OPT_NOARG, NULL, (intptr_t)(p) }
130 #define OPT_CMDMODE(s, l, v, h, i) { OPTION_CMDMODE, (s), (l), (v), NULL, \
131 (h), PARSE_OPT_NOARG|PARSE_OPT_NONEG, NULL, (i) }
132 #define OPT_INTEGER(s, l, v, h) { OPTION_INTEGER, (s), (l), (v), N_("n"), (h) }
t/t0040-parse-options.sh
+3 -4
@@ -30,7 +30,6 @@ String options
30 --string2 <str> get another string
31 --st <st> get another string (pervert ordering)
32 -o <str> get another string
33 - --default-string set string to default
33 --list <str> add str to list
34
35 Magic arguments
@@ -293,7 +292,7 @@ cat > expect <<EOF
292 boolean: 0
293 integer: 0
294 timestamp: 1
296 -string: default
295 +string: (not set)
296 abbrev: 7
297 verbose: 0
298 quiet: yes
@@ -302,8 +301,8 @@ file: (not set)
301 arg 00: foo
302 EOF
303
305 -test_expect_success 'OPT_DATE() and OPT_SET_PTR() work' '
306 - test-parse-options -t "1970-01-01 00:00:01 +0000" --default-string \
304 +test_expect_success 'OPT_DATE() works' '
305 + test-parse-options -t "1970-01-01 00:00:01 +0000" \
306 foo -q > output 2> output.err &&
307 test_must_be_empty output.err &&
308 test_cmp expect output
test-parse-options.c
-2
@@ -59,8 +59,6 @@ int main(int argc, char **argv)
59 OPT_STRING(0, "st", &string, "st", "get another string (pervert ordering)"),
60 OPT_STRING('o', NULL, &string, "str", "get another string"),
61 OPT_NOOP_NOARG(0, "obsolete"),
62 - OPT_SET_PTR(0, "default-string", &string,
63 - "set string to default", "default"),
62 OPT_STRING_LIST(0, "list", &list, "str", "add str to list"),
63 OPT_GROUP("Magic arguments"),
64 OPT_ARGUMENT("quux", "means --quux"),