Merge branch 'ab/parse-options-cleanup'

Change the type of an internal function to return an enum (instead
of int) and replace -2 that was used to signal an error with -1.

* ab/parse-options-cleanup:
  parse-options.c: use "enum parse_opt_result" for parse_nodash_opt()
This commit is contained in:
Junio C Hamano 2021-12-15 09:39:54 -08:00
commit bc32aa1e63

View File

@ -404,8 +404,9 @@ is_abbreviated:
return PARSE_OPT_UNKNOWN;
}
static int parse_nodash_opt(struct parse_opt_ctx_t *p, const char *arg,
const struct option *options)
static enum parse_opt_result parse_nodash_opt(struct parse_opt_ctx_t *p,
const char *arg,
const struct option *options)
{
const struct option *all_opts = options;
@ -415,7 +416,7 @@ static int parse_nodash_opt(struct parse_opt_ctx_t *p, const char *arg,
if (options->short_name == arg[0] && arg[1] == '\0')
return get_value(p, options, all_opts, OPT_SHORT);
}
return -2;
return PARSE_OPT_ERROR;
}
static void check_typos(const char *arg, const struct option *options)