From 99ce8b2d85b77b5f545068912333c23bab8b1e23 Mon Sep 17 00:00:00 2001 From: dan Date: Wed, 25 Oct 2000 22:41:03 +0000 Subject: [PATCH] Fixed wtrimspace() whih had wrong behavior. --- WINGs/string.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/WINGs/string.c b/WINGs/string.c index 172216ac..3d115b3f 100644 --- a/WINGs/string.c +++ b/WINGs/string.c @@ -162,15 +162,15 @@ wtrimspace(char *s) { char *t; char *c; - + while (isspace(*s) && *s) s++; - t = s+strlen(s); + t = s+strlen(s)-1; while (t > s && isspace(*t)) t--; - - c = wmalloc(t-s + 1); - memcpy(c, s, t-s); - c[t-s] = 0; - + + c = wmalloc(t-s+2); + memcpy(c, s, t-s+1); + c[t-s+1] = 0; + return c; } -- 2.11.4.GIT