about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorBart Schaefer <barts@users.sourceforge.net>2001-10-24 15:58:51 +0000
committerBart Schaefer <barts@users.sourceforge.net>2001-10-24 15:58:51 +0000
commit18e997ec52d4cfa156585419f80719516a12351b (patch)
treed9b1ed6f609b8e37fbeafdd8f67669fc9cc155ad /Src
parent24832377d7215614fa4ff735b1b85fa94513cdf4 (diff)
downloadzsh-18e997ec52d4cfa156585419f80719516a12351b.tar.gz
zsh-18e997ec52d4cfa156585419f80719516a12351b.tar.xz
zsh-18e997ec52d4cfa156585419f80719516a12351b.zip
16038,16041,16124: Fix bad caching of patterns.
Diffstat (limited to 'Src')
-rw-r--r--Src/cond.c4
-rw-r--r--Src/loop.c17
2 files changed, 10 insertions, 11 deletions
diff --git a/Src/cond.c b/Src/cond.c
index 5593097a0..b34a14be1 100644
--- a/Src/cond.c
+++ b/Src/cond.c
@@ -202,11 +202,11 @@ evalcond(Estate state)
 		char *opat;
 		int save;
 
-		right = opat = dupstring(ecrawstr(state->prog, state->pc,
+		right = dupstring(opat = ecrawstr(state->prog, state->pc,
 						  &htok));
 		if (htok)
 		    singsub(&right);
-		save = (state->prog->alloc != EA_HEAP &&
+		save = (!(state->prog->flags & EF_HEAP) &&
 			!strcmp(opat, right) && pprog != dummy_patprog2);
 
 		if (!(pprog = patcompile(right, (save ? PAT_ZDUP : PAT_STATIC),
diff --git a/Src/loop.c b/Src/loop.c
index 668f47b97..6e83562bf 100644
--- a/Src/loop.c
+++ b/Src/loop.c
@@ -38,7 +38,7 @@ int loops;
 /* # of continue levels */
  
 /**/
-int contflag;
+mod_export int contflag;
  
 /* # of break levels */
  
@@ -524,9 +524,9 @@ execcase(Estate state, int do_exec)
 	if (isset(XTRACE)) {
 	    char *pat2, *opat;
 
-	    opat = pat = ecgetstr(state, EC_DUP, NULL);
+	    pat = dupstring(opat = ecrawstr(state->prog, state->pc, NULL));
 	    singsub(&pat);
-	    save = (state->prog->alloc != EA_HEAP &&
+	    save = (!(state->prog->flags & EF_HEAP) &&
 		    !strcmp(pat, opat) && *spprog != dummy_patprog2);
 
 	    pat2 = dupstring(pat);
@@ -534,9 +534,8 @@ execcase(Estate state, int do_exec)
 	    printprompt4();
 	    fprintf(xtrerr, "case %s (%s)\n", word, pat2);
 	    fflush(xtrerr);
-	    state->pc++;
-	} else
-	    state->pc += 2;
+	}
+	state->pc += 2;
 
 	if (*spprog != dummy_patprog1 && *spprog != dummy_patprog2)
 	    pprog = *spprog;
@@ -546,11 +545,11 @@ execcase(Estate state, int do_exec)
 		char *opat;
 		int htok = 0;
 
-		opat = pat = dupstring(ecrawstr(state->prog,
+		pat = dupstring(opat = ecrawstr(state->prog,
 						state->pc - 2, &htok));
 		if (htok)
 		    singsub(&pat);
-		save = (state->prog->alloc != EA_HEAP &&
+		save = (!(state->prog->flags & EF_HEAP) &&
 			!strcmp(pat, opat) && *spprog != dummy_patprog2);
 	    }
 	    if (!(pprog = patcompile(pat, (save ? PAT_ZDUP : PAT_STATIC),
@@ -567,7 +566,7 @@ execcase(Estate state, int do_exec)
 		state->pc = next;
 		code = *state->pc;
 		state->pc += 3;
-		next = state->pc + WC_CASE_SKIP(code) - 1;
+		next = state->pc + WC_CASE_SKIP(code) - 2;
 		execlist(state, 1, ((WC_CASE_TYPE(code) == WC_CASE_OR) &&
 				    do_exec));
 	    }