zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: reallocation of prompt
@ 2009-05-12 19:52 Peter Stephenson
  0 siblings, 0 replies; only message in thread
From: Peter Stephenson @ 2009-05-12 19:52 UTC (permalink / raw)
  To: Zsh hackers list

Bart sent me a valgrind trace of a problem in the prompt code that I've
finally run to earth.

Index: Src/prompt.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/prompt.c,v
retrieving revision 1.57
diff -u -r1.57 prompt.c
--- Src/prompt.c	24 Oct 2008 10:27:26 -0000	1.57
+++ Src/prompt.c	12 May 2009 19:50:53 -0000
@@ -841,6 +841,7 @@
     if((bv->bp - bv->buf) + need > bv->bufspc) {
 	int bo = bv->bp - bv->buf;
 	int bo1 = bv->bp1 ? bv->bp1 - bv->buf : -1;
+	ptrdiff_t bufline_off = bv->bufline ? bv->bufline - bv->buf : -1;
 
 	if(need & 255)
 	    need = (need | 255) + 1;
@@ -848,6 +849,8 @@
 	bv->bp = bv->buf + bo;
 	if(bo1 != -1)
 	    bv->bp1 = bv->buf + bo1;
+	if (bufline_off != -1)
+	    bv->bufline = bv->buf + bufline_off;
     }
 }
 

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


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

only message in thread, other threads:[~2009-05-12 19:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-12 19:52 PATCH: reallocation of prompt 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).