summaryrefslogtreecommitdiff
path: root/x2p
diff options
context:
space:
mode:
authorH.Merijn Brand <h.m.brand@xs4all.nl>2002-02-28 19:55:48 +0100
committerJarkko Hietaniemi <jhi@iki.fi>2002-03-01 13:14:18 +0000
commit0335b3e4877101bf2e3432e3eba39bec611df164 (patch)
tree303f1bc08b16c302180e548b016e82be18d8d11e /x2p
parent611c1e95ac3070d4c5cdf44f47c6d9634aaaad72 (diff)
downloadperl-0335b3e4877101bf2e3432e3eba39bec611df164.tar.gz
Re: Smoke 14900 /pro/3gl/CPAN/perl-current
From: "H.Merijn Brand" <h.m.brand@hccnet.nl> Message-Id: <20020228173120.6A15.H.M.BRAND@hccnet.nl> p4raw-id: //depot/perl@14921
Diffstat (limited to 'x2p')
-rw-r--r--x2p/walk.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/x2p/walk.c b/x2p/walk.c
index f4f7fe802f..997ea34cd2 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;