zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@sunsite.dk (Zsh hackers list)
Subject: PATCH: reallocation of prompt
Date: Tue, 12 May 2009 20:52:53 +0100	[thread overview]
Message-ID: <9858.1242157973@pws-pc> (raw)

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/


                 reply	other threads:[~2009-05-12 19:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9858.1242157973@pws-pc \
    --to=p.w.stephenson@ntlworld.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).