about summary refs log tree commit diff
path: root/Src/input.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2004-07-11 22:53:01 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2004-07-11 22:53:01 +0000
commit86ae90bc1c2866b1b10a326d4cdbdb8b02a9f9a9 (patch)
tree0411ce469f4c945ade10a3aca46d1ea1c79e8237 /Src/input.c
parentf63b677f53d19553e7f63755fe4575638d64ae86 (diff)
downloadzsh-86ae90bc1c2866b1b10a326d4cdbdb8b02a9f9a9.tar.gz
zsh-86ae90bc1c2866b1b10a326d4cdbdb8b02a9f9a9.tar.xz
zsh-86ae90bc1c2866b1b10a326d4cdbdb8b02a9f9a9.zip
20149: improve prompt-reset code
20150: commit ancient memory leak fix(?) in completion
Diffstat (limited to 'Src/input.c')
-rw-r--r--Src/input.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/Src/input.c b/Src/input.c
index c07583781..739c7cf42 100644
--- a/Src/input.c
+++ b/Src/input.c
@@ -222,21 +222,21 @@ ingetc(void)
 static int
 inputline(void)
 {
-    char *ingetcline, *ingetcpmptl = NULL, *ingetcpmptr = NULL;
+    char *ingetcline, **ingetcpmptl = NULL, **ingetcpmptr = NULL;
     int context = ZLCON_LINE_START;
 
     /* If reading code interactively, work out the prompts. */
     if (interact && isset(SHINSTDIN)) {
 	if (!isfirstln) {
-	    ingetcpmptl = prompt2;
+	    ingetcpmptl = &prompt2;
 	    if (rprompt2)
-		ingetcpmptr = rprompt2;
+		ingetcpmptr = &rprompt2;
 	    context = ZLCON_LINE_CONT;
 	}
 	else {
-	    ingetcpmptl = prompt;
+	    ingetcpmptl = &prompt;
 	    if (rprompt)
-		ingetcpmptr = rprompt;
+		ingetcpmptr = &rprompt;
 	}
     }
     if (!(interact && isset(SHINSTDIN) && SHTTY != -1 && isset(USEZLE))) {
@@ -255,7 +255,8 @@ inputline(void)
 	     */
 	    char *pptbuf;
 	    int pptlen;
-	    pptbuf = unmetafy(promptexpand(ingetcpmptl, 0, NULL, NULL), &pptlen);
+	    pptbuf = unmetafy(promptexpand(ingetcpmptl ? *ingetcpmptl : NULL,
+					   0, NULL, NULL), &pptlen);
 	    write(2, (WRITE_ARG_2_T)pptbuf, pptlen);
 	    free(pptbuf);
 	}