zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: fix for zle line size
@ 2005-01-26 12:12 Peter Stephenson
  0 siblings, 0 replies; only message in thread
From: Peter Stephenson @ 2005-01-26 12:12 UTC (permalink / raw)
  To: Zsh hackers list

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@csr.com>                  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
**********************************************************************


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-01-26 12:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-26 12:12 PATCH: fix for zle line size Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).