From d0913e33f0b77c45854d816d41fd6c8e26ad54d8 Mon Sep 17 00:00:00 2001 From: James Bursa Date: Mon, 15 Mar 2004 15:03:34 +0000 Subject: [project @ 2004-03-15 15:03:34 by bursa] Remove isspace() calls to avoid squashing nbsp (see setlocale() change). svn path=/import/netsurf/; revision=624 --- utils/utils.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'utils/utils.c') diff --git a/utils/utils.c b/utils/utils.c index cfffd06a6..3f96125ee 100644 --- a/utils/utils.c +++ b/utils/utils.c @@ -31,7 +31,10 @@ void die(const char * const error) char * strip(char * const s) { size_t i; - for (i = strlen(s); i != 0 && isspace(s[i-1]); i--) + for (i = strlen(s); + i != 0 && (s[i - 1] == ' ' || s[i - 1] == '\n' || + s[i - 1] == '\r' || s[i - 1] == '\t'); + i--) ; s[i] = 0; return s + strspn(s, " \t\r\n"); @@ -102,9 +105,11 @@ char * squash_whitespace(const char * s) int i = 0, j = 0; if (c == 0) die("Out of memory in squash_whitespace()"); do { - if (isspace(s[i])) { + if (s[i] == ' ' || s[i] == '\n' || s[i] == '\r' || + s[i] == '\t') { c[j++] = ' '; - while (s[i] != 0 && isspace(s[i])) + while (s[i] == ' ' || s[i] == '\n' || s[i] == '\r' || + s[i] == '\t') i++; } c[j++] = s[i++]; -- cgit v1.2.3