parse-options: avoid magic return codes
Give names to these magic negative numbers. Make parse_opt_ll_cb return an enum to make clear it can actually control parse_options() with different return values (parse_opt_cb can too, but nobody needs it). Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
bf3ff338a2
commit
f41179f16b
@ -847,8 +847,8 @@ static int parse_new_style_cacheinfo(const char *arg,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cacheinfo_callback(struct parse_opt_ctx_t *ctx,
|
||||
const struct option *opt, int unset)
|
||||
static enum parse_opt_result cacheinfo_callback(
|
||||
struct parse_opt_ctx_t *ctx, const struct option *opt, int unset)
|
||||
{
|
||||
struct object_id oid;
|
||||
unsigned int mode;
|
||||
@ -873,8 +873,8 @@ static int cacheinfo_callback(struct parse_opt_ctx_t *ctx,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int stdin_cacheinfo_callback(struct parse_opt_ctx_t *ctx,
|
||||
const struct option *opt, int unset)
|
||||
static enum parse_opt_result stdin_cacheinfo_callback(
|
||||
struct parse_opt_ctx_t *ctx, const struct option *opt, int unset)
|
||||
{
|
||||
int *nul_term_line = opt->value;
|
||||
|
||||
@ -887,8 +887,8 @@ static int stdin_cacheinfo_callback(struct parse_opt_ctx_t *ctx,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int stdin_callback(struct parse_opt_ctx_t *ctx,
|
||||
const struct option *opt, int unset)
|
||||
static enum parse_opt_result stdin_callback(
|
||||
struct parse_opt_ctx_t *ctx, const struct option *opt, int unset)
|
||||
{
|
||||
int *read_from_stdin = opt->value;
|
||||
|
||||
@ -900,8 +900,8 @@ static int stdin_callback(struct parse_opt_ctx_t *ctx,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int unresolve_callback(struct parse_opt_ctx_t *ctx,
|
||||
const struct option *opt, int unset)
|
||||
static enum parse_opt_result unresolve_callback(
|
||||
struct parse_opt_ctx_t *ctx, const struct option *opt, int unset)
|
||||
{
|
||||
int *has_errors = opt->value;
|
||||
const char *prefix = startup_info->prefix;
|
||||
@ -919,8 +919,8 @@ static int unresolve_callback(struct parse_opt_ctx_t *ctx,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int reupdate_callback(struct parse_opt_ctx_t *ctx,
|
||||
const struct option *opt, int unset)
|
||||
static enum parse_opt_result reupdate_callback(
|
||||
struct parse_opt_ctx_t *ctx, const struct option *opt, int unset)
|
||||
{
|
||||
int *has_errors = opt->value;
|
||||
const char *prefix = startup_info->prefix;
|
||||
|
||||
Reference in New Issue
Block a user