Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: zle status line
- X-seq: zsh-workers 20866
- From: Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: PATCH: zle status line
- Date: Thu, 24 Feb 2005 21:11:40 +0000
- In-reply-to: <200502242244.53160.arvidjaar@xxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <200502241349.j1ODnc5a018479@xxxxxxxxxxxxxx> <200502242244.53160.arvidjaar@xxxxxxxxxx>
Andrey Borzenkov wrote:
> e-n-c passes constant prmt that unmetafy is trying to assign to. It is too
> late for me to decide whether all callers of stringaslinezle or it itself
> should provide a writable copy of instr.
Oops, it should be the caller and it's even documented. I hope there
aren't other cases I've missed. There's also a typo that only
gets triggered on completion in execute-named-command owing to lazy
symbol resolution.
Index: Src/Zle/zle_misc.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_misc.c,v
retrieving revision 1.19
diff -u -r1.19 zle_misc.c
--- Src/Zle/zle_misc.c 24 Feb 2005 15:32:57 -0000 1.19
+++ Src/Zle/zle_misc.c 24 Feb 2005 21:07:09 -0000
@@ -775,10 +775,13 @@
char *okeymap = ztrdup(curkeymapname);
clearlist = 1;
+ /* prmt may be constant */
+ prmt = ztrdup(prmt);
zprmt = stringaszleline((unsigned char *)prmt, &l, NULL);
cmdbuf = zhalloc((l + NAMLEN + 2) * ZLE_CHAR_SIZE);
ZS_memcpy(cmdbuf, zprmt, l);
free(zprmt);
+ zsfree(prmt);
statusline = cmdbuf;
selectkeymap("main", 1);
ptr = cmdbuf += l;
@@ -919,7 +922,7 @@
int ltmp;
ZLE_STRING_T ztmp = stringaszleline(peekfirst(cmdll),
<mp, NULL);
- ZS_mempcy(cmdbuf, ztmp, ltmp);
+ ZS_memcpy(cmdbuf, ztmp, ltmp);
free(ztmp);
ptr = cmdbuf + cmdambig;
*ptr = ZWC('_');
--
Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxx>
Work: pws@xxxxxxx
Web: http://www.pwstephenson.fsnet.co.uk
Messages sorted by:
Reverse Date,
Date,
Thread,
Author