Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: vanishing history



On Mon, 18 Feb 2002, Adam Spiers wrote:
> this patch (or at least, the combination of all cvs commits over the
> last few weeks) makes zsh core dump when I try that way, which is to
> simply type ^X?, which is bound to _complete_debug.

This is because of a bug in my recent changes in prepnexthistent().
I've just checked in a fix for this.

My history doesn't vanish running this, so if you can still duplicate
the vanishing-history problem, let me know.

..wayne..

---8<------8<------8<------8<---cut here--->8------>8------>8------>8---
Index: Src/hist.c
--- Src/hist.c	16 Feb 2002 09:21:34 -0000	1.40
+++ Src/hist.c	18 Feb 2002 19:24:34 -0000
@@ -947,6 +947,7 @@
 Histent
 prepnexthistent(void)
 {
+    Histent he;
     int curline_in_ring = hist_ring == &curline;

     if (curline_in_ring)
@@ -957,7 +958,7 @@
     }

     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 @@
     }
     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() */
---8<------8<------8<------8<---cut here--->8------>8------>8------>8---



Messages sorted by: Reverse Date, Date, Thread, Author