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:
Nguyễn Thái Ngọc Duy
2019-01-27 07:35:27 +07:00
committed by Junio C Hamano
parent bf3ff338a2
commit f41179f16b
5 changed files with 68 additions and 46 deletions

View File

@ -112,8 +112,9 @@ static int option_parse_message(const struct option *opt,
return 0;
}
static int option_read_message(struct parse_opt_ctx_t *ctx,
const struct option *opt, int unset)
static enum parse_opt_result option_read_message(struct parse_opt_ctx_t *ctx,
const struct option *opt,
int unset)
{
struct strbuf *buf = opt->value;
const char *arg;