diff options
author | Volker Lendecke <vl@samba.org> | 2015-04-26 11:15:01 +0200 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2015-04-27 23:54:27 +0200 |
commit | af03b5752bf91e3db33f5a28b2b86b25666764b6 (patch) | |
tree | 0f02977a5cf394d49bac8126ad6e97a06b831275 /lib | |
parent | 38553a305fe4021e2bd034bed11eaef18863aa0a (diff) | |
download | samba-af03b5752bf91e3db33f5a28b2b86b25666764b6.tar.gz |
lib: Use isspace on unsigned char
Signed-off-by: Volker Lendecke <vl@samba.org>
Bug: https://bugzilla.samba.org/show_bug.cgi?id=11223
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Apr 27 23:54:27 CEST 2015 on sn-devel-104
Diffstat (limited to 'lib')
-rw-r--r-- | lib/util/tini.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/util/tini.c b/lib/util/tini.c index 6cd301a0b1b..3bfc2d6511f 100644 --- a/lib/util/tini.c +++ b/lib/util/tini.c @@ -43,12 +43,21 @@ #include <string.h> #include "tini.h" +static bool c_isspace(char c) +{ + unsigned char uc = c; + if (c != uc) { + return false; + } + return isspace(uc); +} + static int next_content(FILE *f) { int c; for (c = fgetc(f); c != EOF; c = fgetc(f)) { - if (!isspace(c)) { + if (!c_isspace(c)) { break; } if (c == '\n') { @@ -145,7 +154,7 @@ next_line: } if ((pos > 1) && (buf[pos-2] == '\\') && - isspace(buf[pos-1])) { + c_isspace(buf[pos-1])) { /* * Line ends in "\ ". Mind that we zap * multiple spaces into one. Continuation. @@ -160,7 +169,7 @@ next_line: break; } - if ((pos > 0) && isspace(buf[pos-1]) && isspace(c)) { + if ((pos > 0) && c_isspace(buf[pos-1]) && c_isspace(c)) { /* * Zap multiple spaces to one */ @@ -203,14 +212,14 @@ static char *trim_one_space(char *buf) { size_t len; - if (isspace(buf[0])) { + if (c_isspace(buf[0])) { buf += 1; } len = strlen(buf); if (len == 0) { return buf; } - if (isspace(buf[len-1])) { + if (c_isspace(buf[len-1])) { buf[len-1] = '\0'; } |