From: Nicholas Clark Date: Tue, 20 Dec 2005 12:51:21 +0000 (+0000) Subject: In Perl_yylex, move the declaration of orig_keyword, gv and gvp down to X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0bfa2a8afc04ca8a47987d5890bbbe751faf4444;p=p5sagit%2Fp5-mst-13.2.git In Perl_yylex, move the declaration of orig_keyword, gv and gvp down to the block labelled keylookup. p4raw-id: //depot/perl@26414 --- diff --git a/toke.c b/toke.c index 18a89bd..13fd766 100644 --- a/toke.c +++ b/toke.c @@ -2426,10 +2426,7 @@ Perl_yylex(pTHX) register char *s = PL_bufptr; register char *d; STRLEN len; - GV *gv = Nullgv; - GV **gvp = 0; bool bof = FALSE; - I32 orig_keyword = 0; DEBUG_T( { SV* tmp = newSVpvn("", 0); @@ -3235,7 +3232,7 @@ Perl_yylex(pTHX) case ':': if (s[1] == ':') { len = 0; - goto just_a_word; + goto just_a_word_zero_gv; } s++; switch (PL_expect) { @@ -4123,12 +4120,9 @@ Perl_yylex(pTHX) keylookup: { I32 tmp; - assert (orig_keyword == 0); - assert (gv == 0); - assert (gvp == 0); - orig_keyword = 0; - gv = Nullgv; - gvp = 0; + I32 orig_keyword = 0; + GV *gv = Nullgv; + GV **gvp = 0; PL_bufptr = s; s = scan_word(s, PL_tokenbuf, sizeof PL_tokenbuf, FALSE, &len); @@ -4231,6 +4225,15 @@ Perl_yylex(pTHX) switch (tmp) { default: /* not a keyword */ + /* Trade off - by using this evil construction we can pull the + variable gv into the block labelled keylookup. If not, then + we have to give it function scope so that the goto from the + earlier ':' case doesn't bypass the initialisation. */ + if (0) { + just_a_word_zero_gv: + gv = NULL; + gvp = NULL; + } just_a_word: { SV *sv; int pkgname = 0;