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

PATCH: fix for zle line size



Required by my last patch: sizeline() needs to be more flexible because
we may reallocate a line from scratch which we didn't need to do
before.  I saw this as a hang running zcalc; I think it's to do with
an empty history line.

Index: Src/Zle/zle_utils.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_utils.c,v
retrieving revision 1.15
diff -u -r1.15 zle_utils.c
--- Src/Zle/zle_utils.c	25 Jan 2005 16:41:24 -0000	1.15
+++ Src/Zle/zle_utils.c	26 Jan 2005 12:10:09 -0000
@@ -67,9 +67,16 @@
 sizeline(int sz)
 {
     while (sz > linesz)
-	zleline = 
+    {
+	if (linesz < 256)
+	    linesz = 256;
+	else
+	    linesz *= 4;
+
+	zleline =
 	    (ZLE_STRING_T)realloc(zleline,
-				  ((linesz *= 4) + 2) * ZLE_CHAR_SIZE);
+				  (linesz + 2) * ZLE_CHAR_SIZE);
+    }
 }
 
 /*

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************



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