summary refs log tree commit diff
diff options
context:
space:
mode:
authorWayne Davison <wayned@users.sourceforge.net>2002-02-18 19:25:25 +0000
committerWayne Davison <wayned@users.sourceforge.net>2002-02-18 19:25:25 +0000
commit3b3bafac805562e943b5a93642c64593ef8f5837 (patch)
treed7fd5e505714897ca07c466c03c27beeb35e17ec
parentbecf65dd7f1e512995eb928f212491d6b1cc8cc7 (diff)
downloadzsh-3b3bafac805562e943b5a93642c64593ef8f5837.tar.gz
zsh-3b3bafac805562e943b5a93642c64593ef8f5837.tar.xz
zsh-3b3bafac805562e943b5a93642c64593ef8f5837.zip
Fixed a just-introduced bug in prepnexthistent() when curline is in
the list.
-rw-r--r--Src/hist.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/Src/hist.c b/Src/hist.c
index c7b4641df..4f78e7309 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -947,6 +947,7 @@ putoldhistentryontop(short keep_going)
 Histent
 prepnexthistent(void)
 {
+    Histent he; 
     int curline_in_ring = hist_ring == &curline;
 
     if (curline_in_ring)
@@ -957,7 +958,7 @@ prepnexthistent(void)
     }
 
     if (histlinect < histsiz) {
-	Histent he = (Histent)zcalloc(sizeof *he);
+	he = (Histent)zcalloc(sizeof *he);
 	if (!hist_ring)
 	    hist_ring = he->up = he->down = he;
 	else {
@@ -970,12 +971,12 @@ prepnexthistent(void)
     }
     else {
 	putoldhistentryontop(0);
-	freehistdata(hist_ring, 0);
+	freehistdata(he = hist_ring, 0);
     }
-    hist_ring->histnum = ++curhist;
+    he->histnum = ++curhist;
     if (curline_in_ring)
 	linkcurline();
-    return hist_ring;
+    return he;
 }
 
 /* A helper function for hend() */