diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2019-01-27 01:35:28 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-01-28 01:28:18 +0100 |
commit | 3ebbe289896a698b99c91b797440563272dcd716 (patch) | |
tree | 09798977c8fc962c33fb6e3c95285484d9d855b2 /parse-options.h | |
parent | parse-options: avoid magic return codes (diff) | |
download | git-3ebbe289896a698b99c91b797440563272dcd716.tar.xz git-3ebbe289896a698b99c91b797440563272dcd716.zip |
parse-options: allow ll_callback with OPTION_CALLBACK
OPTION_CALLBACK is much simpler/safer to use, but parse_opt_cb does
not allow access to parse_opt_ctx_t, which sometimes is useful
(e.g. to obtain the prefix).
Extending parse_opt_cb to take parse_opt_cb could result in a lot of
changes. Instead let's just allow ll_callback to be used with
OPTION_CALLBACK. The user will have to be careful, not to change
anything in ctx, or return wrong result code. But that's the price for
ll_callback.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'parse-options.h')
-rw-r--r-- | parse-options.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/parse-options.h b/parse-options.h index 4e49185027..ce75278804 100644 --- a/parse-options.h +++ b/parse-options.h @@ -50,7 +50,8 @@ typedef int parse_opt_cb(const struct option *, const char *arg, int unset); struct parse_opt_ctx_t; typedef enum parse_opt_result parse_opt_ll_cb(struct parse_opt_ctx_t *ctx, - const struct option *opt, int unset); + const struct option *opt, + const char *arg, int unset); /* * `type`:: @@ -267,7 +268,7 @@ int parse_opt_commits(const struct option *, const char *, int); int parse_opt_tertiary(const struct option *, const char *, int); int parse_opt_string_list(const struct option *, const char *, int); int parse_opt_noop_cb(const struct option *, const char *, int); -int parse_opt_unknown_cb(struct parse_opt_ctx_t *ctx, const struct option *, int); +int parse_opt_unknown_cb(struct parse_opt_ctx_t *ctx, const struct option *, const char *, int); int parse_opt_passthru(const struct option *, const char *, int); int parse_opt_passthru_argv(const struct option *, const char *, int); |