From 3b3bafac805562e943b5a93642c64593ef8f5837 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Mon, 18 Feb 2002 19:25:25 +0000 Subject: Fixed a just-introduced bug in prepnexthistent() when curline is in the list. --- Src/hist.c | 9 +++++---- 1 file 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() */ -- cgit 1.4.1