prepare_revision_walk(): check for return value in all places
[gitweb.git] / parse-options.c
index a5fa0b8938cb2820635bbc620b1b26cc903a6c97..b536896f2689dee23afae7d3a169c065592aaabe 100644 (file)
@@ -127,10 +127,6 @@ static int get_value(struct parse_opt_ctx_t *p,
                *(int *)opt->value = opt->defval;
                return 0;
 
-       case OPTION_SET_PTR:
-               *(void **)opt->value = unset ? NULL : (void *)opt->defval;
-               return 0;
-
        case OPTION_STRING:
                if (unset)
                        *(const char **)opt->value = NULL;
@@ -367,7 +363,6 @@ static void parse_options_check(const struct option *opts)
                case OPTION_BIT:
                case OPTION_NEGBIT:
                case OPTION_SET_INT:
-               case OPTION_SET_PTR:
                case OPTION_NUMBER:
                        if ((opts->flags & PARSE_OPT_OPTARG) ||
                            !(opts->flags & PARSE_OPT_NOARG))
@@ -375,6 +370,9 @@ static void parse_options_check(const struct option *opts)
                default:
                        ; /* ok. (usually accepts an argument) */
                }
+               if (opts->argh &&
+                   strcspn(opts->argh, " _") != strlen(opts->argh))
+                       err |= optbug(opts, "multi-word argh should use dash to separate words");
        }
        if (err)
                exit(128);