summaryrefslogtreecommitdiff
path: root/utils/utils.c
diff options
context:
space:
mode:
authorJames Bursa <james@netsurf-browser.org>2004-03-15 15:03:34 +0000
committerJames Bursa <james@netsurf-browser.org>2004-03-15 15:03:34 +0000
commitd0913e33f0b77c45854d816d41fd6c8e26ad54d8 (patch)
tree066a84d4dce73ba2ca1e11e2ddcff6683d13a756 /utils/utils.c
parenta678c8a6c717f0aa4a0072f4230d37d5e4bc76c5 (diff)
downloadnetsurf-d0913e33f0b77c45854d816d41fd6c8e26ad54d8.tar.gz
netsurf-d0913e33f0b77c45854d816d41fd6c8e26ad54d8.tar.bz2
[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
Diffstat (limited to 'utils/utils.c')
-rw-r--r--utils/utils.c11
1 files changed, 8 insertions, 3 deletions
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++];