The Samba-Bugzilla – Attachment 10988 Details for
Bug 11223
Incorrect use of isspace
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
look (text/plain), 1.61 KB, created by
Volker Lendecke
on 2015-04-26 09:24:56 UTC
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Volker Lendecke
Created:
2015-04-26 09:24:56 UTC
Size:
1.61 KB
patch
obsolete
>From 5c37cc79ed28fb29152929b74361aa624557d9a1 Mon Sep 17 00:00:00 2001 >From: Volker Lendecke <vl@samba.org> >Date: Sun, 26 Apr 2015 11:15:01 +0200 >Subject: [PATCH] lib: Use isspace on unsigned char > >Signed-off-by: Volker Lendecke <vl@samba.org> >Bug: https://bugzilla.samba.org/show_bug.cgi?id=11223 >--- > lib/util/tini.c | 19 ++++++++++++++----- > 1 file changed, 14 insertions(+), 5 deletions(-) > >diff --git a/lib/util/tini.c b/lib/util/tini.c >index 6cd301a..3bfc2d6 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'; > } > >-- >1.9.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 11223
: 10988