From: H.Merijn Brand Date: Thu, 28 Feb 2002 18:55:48 +0000 (+0100) Subject: Re: Smoke 14900 /pro/3gl/CPAN/perl-current X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0335b3e4877101bf2e3432e3eba39bec611df164;p=p5sagit%2Fp5-mst-13.2.git Re: Smoke 14900 /pro/3gl/CPAN/perl-current From: "H.Merijn Brand" Message-Id: <20020228173120.6A15.H.M.BRAND@hccnet.nl> p4raw-id: //depot/perl@14921 --- diff --git a/x2p/walk.c b/x2p/walk.c index f4f7fe8..997ea34 100644 --- a/x2p/walk.c +++ b/x2p/walk.c @@ -52,7 +52,7 @@ walk(int useval, int level, register int node, int *numericptr, int minprec) STR *tmp2str; STR *tmp3str; char *t; - char *d, *s = 0; + char *d, *s; int numarg; int numeric = FALSE; STR *fstr; @@ -822,11 +822,8 @@ sub Pick {\n\ str_cat(str,")"); break; case OGSUB: - case OSUB: - if (type == OGSUB) - s = "g"; - else - s = ""; + case OSUB: { + int gsub = type == OGSUB ? 1 : 0; str = str_new(0); tmpstr = str_new(0); i = 0; @@ -856,6 +853,7 @@ sub Pick {\n\ } *d = '\0'; str_set(tmp2str,tokenbuf); + s = gsub ? "/g" : "/"; } else { tmp2str=walk(1,level,ops[node+2].ival,&numarg,P_MIN); @@ -863,9 +861,10 @@ sub Pick {\n\ str_scat(tmp3str,tmp2str); str_cat(tmp3str,").'\"') =~ s/&/\\$&/g, "); str_set(tmp2str,"eval $s_"); - s = (char*)(*s == 'g' ? "ge" : "e"); + s = gsub ? "/ge" : "/e"; i++; } + str_cat(tmp2str,s); type = ops[ops[node+1].ival].ival; len = type >> 8; type &= 255; @@ -877,8 +876,6 @@ sub Pick {\n\ str_scat(str,tmpstr); str_scat(str,fstr); str_scat(str,tmp2str); - str_cat(str,"/"); - str_cat(str,s); } else if ((type == OFLD && !split_to_array) || (type == OVAR && len == 1)) { if (useval && i) @@ -889,8 +886,6 @@ sub Pick {\n\ str_scat(str,fstr); str_cat(str,"/"); str_scat(str,tmp2str); - str_cat(str,"/"); - str_cat(str,s); } else { i++; @@ -903,8 +898,6 @@ sub Pick {\n\ str_scat(str,tmpstr); str_cat(str,"/$s/"); str_scat(str,tmp2str); - str_cat(str,"/"); - str_cat(str,s); } if (useval && i) str_cat(str,")"); @@ -913,7 +906,7 @@ sub Pick {\n\ str_free(tmp2str); str_free(tmp3str); numeric = 1; - break; + break; } case ONUM: str = walk(1,level,ops[node+1].ival,&numarg,P_MIN); numeric = 1;