From 6b61ec0564993d2e60f7eb56c0f0fd9c313d5e2c Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Wed, 9 Jul 2008 23:38:34 +0200 Subject: revisions: refactor handle_revision_opt into parse_revision_opt. It seems we're using handle_revision_opt the same way each time, have a wrapper around it that does the 9-liner we copy each time instead. handle_revision_opt can be static in the module for now, it's always possible to make it public again if needed. Signed-off-by: Pierre Habouzit Signed-off-by: Junio C Hamano --- builtin-shortlog.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'builtin-shortlog.c') diff --git a/builtin-shortlog.c b/builtin-shortlog.c index 9107bffb9b..01362022c0 100644 --- a/builtin-shortlog.c +++ b/builtin-shortlog.c @@ -255,21 +255,13 @@ int cmd_shortlog(int argc, const char **argv, const char *prefix) PARSE_OPT_KEEP_ARGV0); for (;;) { - int n; switch (parse_options_step(&ctx, options, shortlog_usage)) { case PARSE_OPT_HELP: exit(129); case PARSE_OPT_DONE: goto parse_done; } - n = handle_revision_opt(&rev, ctx.argc, ctx.argv, - &ctx.cpidx, ctx.out); - if (n <= 0) { - error("unknown option `%s'", ctx.argv[0]); - usage_with_options(shortlog_usage, options); - } - ctx.argv += n; - ctx.argc -= n; + parse_revision_opt(&rev, &ctx, options, shortlog_usage); } parse_done: argc = parse_options_end(&ctx); -- cgit v1.2.3