diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2004-07-11 22:53:01 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2004-07-11 22:53:01 +0000 |
commit | 86ae90bc1c2866b1b10a326d4cdbdb8b02a9f9a9 (patch) | |
tree | 0411ce469f4c945ade10a3aca46d1ea1c79e8237 /Src/Zle/zle_main.c | |
parent | f63b677f53d19553e7f63755fe4575638d64ae86 (diff) | |
download | zsh-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/Zle/zle_main.c')
-rw-r--r-- | Src/Zle/zle_main.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c index 3f13c8af3..765f4dfbe 100644 --- a/Src/Zle/zle_main.c +++ b/Src/Zle/zle_main.c @@ -150,7 +150,7 @@ int kungetct; /**/ mod_export char *zlenoargs[1] = { NULL }; -static char *raw_lp, *raw_rp; +static char **raw_lp, **raw_rp; #ifdef FIONREAD static int delayzsetterm; @@ -742,7 +742,7 @@ zlecore(void) /**/ unsigned char * -zleread(char *lp, char *rp, int flags, int context) +zleread(char **lp, char **rp, int flags, int context) { unsigned char *s; int old_errno = errno; @@ -761,7 +761,8 @@ zleread(char *lp, char *rp, int flags, int context) char *pptbuf; int pptlen; - pptbuf = unmetafy(promptexpand(lp, 0, NULL, NULL), &pptlen); + pptbuf = unmetafy(promptexpand(lp ? *lp : NULL, 0, NULL, NULL), + &pptlen); write(2, (WRITE_ARG_2_T)pptbuf, pptlen); free(pptbuf); return (unsigned char *)shingetline(); @@ -788,10 +789,10 @@ zleread(char *lp, char *rp, int flags, int context) eofsent = 0; resetneeded = 0; raw_lp = lp; - lpromptbuf = promptexpand(lp, 1, NULL, NULL); + lpromptbuf = promptexpand(lp ? *lp : NULL, 1, NULL, NULL); pmpt_attr = txtchange; raw_rp = rp; - rpromptbuf = promptexpand(rp, 1, NULL, NULL); + rpromptbuf = promptexpand(rp ? *rp : NULL, 1, NULL, NULL); rpmpt_attr = txtchange; free_prepostdisplay(); @@ -1169,7 +1170,7 @@ bin_vared(char *name, char **args, Options ops, UNUSED(int func)) if (OPT_ISSET(ops,'h')) hbegin(2); isfirstln = OPT_ISSET(ops,'e'); - t = (char *) zleread(p1, p2, OPT_ISSET(ops,'h') ? ZLRF_HISTORY : 0, + t = (char *) zleread(&p1, &p2, OPT_ISSET(ops,'h') ? ZLRF_HISTORY : 0, ZLCON_VARED); if (OPT_ISSET(ops,'h')) hend(NULL); @@ -1315,9 +1316,9 @@ void reexpandprompt(void) { free(lpromptbuf); - lpromptbuf = promptexpand(raw_lp, 1, NULL, NULL); + lpromptbuf = promptexpand(raw_lp ? *raw_lp : NULL, 1, NULL, NULL); free(rpromptbuf); - rpromptbuf = promptexpand(raw_rp, 1, NULL, NULL); + rpromptbuf = promptexpand(raw_rp ? *raw_rp : NULL, 1, NULL, NULL); } /**/ |