summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2021-11-09 11:04:43 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-11-09 17:45:37 (GMT)
commit06a199f38b50ccea198c29216c69bb389ca23391 (patch)
tree71d2f61783d8246960f6ca6ffeba8b4f1e322f28
parentd342834529495508fa1f23e223d4917cbdcfb54d (diff)
downloadgit-06a199f38b50ccea198c29216c69bb389ca23391.zip
git-06a199f38b50ccea198c29216c69bb389ca23391.tar.gz
git-06a199f38b50ccea198c29216c69bb389ca23391.tar.bz2
parse-options.[ch]: revert use of "enum" for parse_options()
Revert the parse_options() prototype change in my recent 352e761388b (parse-options.[ch]: consistently use "enum parse_opt_result", 2021-10-08) was incorrect. The parse_options() function returns the number of argc elements that haven't been processed, not "enum parse_opt_result". Reported-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--parse-options.c10
-rw-r--r--parse-options.h9
2 files changed, 9 insertions, 10 deletions
diff --git a/parse-options.c b/parse-options.c
index 2a2c0ee..e788584 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -860,11 +860,11 @@ int parse_options_end(struct parse_opt_ctx_t *ctx)
return ctx->cpidx + ctx->argc;
}
-enum parse_opt_result parse_options(int argc, const char **argv,
- const char *prefix,
- const struct option *options,
- const char * const usagestr[],
- enum parse_opt_flags flags)
+int parse_options(int argc, const char **argv,
+ const char *prefix,
+ const struct option *options,
+ const char * const usagestr[],
+ enum parse_opt_flags flags)
{
struct parse_opt_ctx_t ctx;
struct option *real_options;
diff --git a/parse-options.h b/parse-options.h
index dd79c9c..ce2c0df 100644
--- a/parse-options.h
+++ b/parse-options.h
@@ -211,11 +211,10 @@ struct option {
* untouched and parse_options() returns the number of options
* processed.
*/
-enum parse_opt_result parse_options(int argc, const char **argv,
- const char *prefix,
- const struct option *options,
- const char * const usagestr[],
- enum parse_opt_flags flags);
+int parse_options(int argc, const char **argv, const char *prefix,
+ const struct option *options,
+ const char * const usagestr[],
+ enum parse_opt_flags flags);
NORETURN void usage_with_options(const char * const *usagestr,
const struct option *options);