From 394a6b3567999d25191076ef5155e4e6ad01ac09 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Fri, 13 Jan 2006 09:43:46 +0000 Subject: A better version of my last change. --- Src/prompt.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/Src/prompt.c b/Src/prompt.c index 81ed47a30..8b658883f 100644 --- a/Src/prompt.c +++ b/Src/prompt.c @@ -543,18 +543,10 @@ putpromptchar(int doprint, int endchar) if (ztrftime(bp, t0, tmfmt, tm) >= 0) break; } - /* Check if there are any chars to metafy while - * advancing bp to the end of the string. */ - for (ss = bp, t0 = 0; *bp; bp++ ) { - if (imeta(*bp)) - t0++; /* count of Meta chars needed */ - } - if (t0) { - j = bp - ss; /* unmetafied string length */ - addbufspc(t0); - metafy(bp - j, j, META_NOALLOC); - bp += t0; - } + /* There is enough room for this because addbufspc(t0) + * allocates room for t0 * 2 bytes. */ + metafy(bp, -1, META_NOALLOC); + bp += strlen(bp); free(tmbuf); tmbuf = NULL; break; -- cgit 1.4.1