From: Nicholas Clark Date: Thu, 24 Nov 2011 21:34:43 +0000 (+0100) Subject: Simplify S_parse_body() by calling S_usage() and S_minus_v() directly. X-Git-Tag: accepted/trunk/20130322.191538~1868 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ee8bc8b7e369e9f69b93c0b0a137db3c4886a1a3;p=platform%2Fupstream%2Fperl.git Simplify S_parse_body() by calling S_usage() and S_minus_v() directly. Previously the code for "--help" and "--version" set a local variable to a string corresponding to the single character option ("h" or "v" respectively), then restarted the option parsing code, which would then call into Perl_moreswitches(), which would then use a switch statement to dispatch to the final code. This is not as clear as it could be. --- diff --git a/perl.c b/perl.c index 1219e99..66860ed 100644 --- a/perl.c +++ b/perl.c @@ -1938,15 +1938,12 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit) argc--,argv++; goto switch_end; } - /* catch use of gnu style long options */ - if (strEQ(s, "version")) { - s = (char *)"v"; - goto reswitch; - } - if (strEQ(s, "help")) { - s = (char *)"h"; - goto reswitch; - } + /* catch use of gnu style long options. + Both of these exit immediately. */ + if (strEQ(s, "version")) + minus_v(); + if (strEQ(s, "help")) + usage(); s--; /* FALL THROUGH */ default: