parse-options.[ch]: revert use of "enum" for parse_options()

Revert the parse_options() prototype change in my recent
352e761388 (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>
This commit is contained in:
Ævar Arnfjörð Bjarmason 2021-11-09 12:04:43 +01:00 коммит произвёл Junio C Hamano
Родитель d342834529
Коммит 06a199f38b
2 изменённых файлов: 9 добавлений и 10 удалений

Просмотреть файл

@ -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;

Просмотреть файл

@ -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);