use our own ISBLANK macro

This commit is contained in:
Yang Tse 2007-02-13 17:47:27 +00:00
parent 569c169559
commit 6d05a33ed9
3 changed files with 7 additions and 6 deletions

View File

@ -115,6 +115,7 @@
*/ */
#define ISSPACE(x) (isspace((int) ((unsigned char)x))) #define ISSPACE(x) (isspace((int) ((unsigned char)x)))
#define ISBLANK(x) (isblank((int) ((unsigned char)x)))
#define ISDIGIT(x) (isdigit((int) ((unsigned char)x))) #define ISDIGIT(x) (isdigit((int) ((unsigned char)x)))
#define ISALNUM(x) (isalnum((int) ((unsigned char)x))) #define ISALNUM(x) (isalnum((int) ((unsigned char)x)))
#define ISXDIGIT(x) (isxdigit((int) ((unsigned char)x))) #define ISXDIGIT(x) (isxdigit((int) ((unsigned char)x)))

View File

@ -102,7 +102,6 @@ Example set of cookies:
#include "memdebug.h" #include "memdebug.h"
#endif #endif
#define my_isspace(x) ((x == ' ') || (x == '\t'))
static void freecookie(struct Cookie *co) static void freecookie(struct Cookie *co)
{ {
@ -206,7 +205,7 @@ Curl_cookie_add(struct SessionHandle *data,
semiptr=strchr(lineptr, ';'); /* first, find a semicolon */ semiptr=strchr(lineptr, ';'); /* first, find a semicolon */
while(*lineptr && my_isspace(*lineptr)) while(*lineptr && ISBLANK(*lineptr))
lineptr++; lineptr++;
ptr = lineptr; ptr = lineptr;
@ -229,14 +228,14 @@ Curl_cookie_add(struct SessionHandle *data,
/* Strip off trailing whitespace from the 'what' */ /* Strip off trailing whitespace from the 'what' */
size_t len=strlen(what); size_t len=strlen(what);
while(len && my_isspace(what[len-1])) { while(len && ISBLANK(what[len-1])) {
what[len-1]=0; what[len-1]=0;
len--; len--;
} }
/* Skip leading whitespace from the 'what' */ /* Skip leading whitespace from the 'what' */
whatptr=what; whatptr=what;
while(my_isspace(*whatptr)) { while(*whatptr && ISBLANK(*whatptr)) {
whatptr++; whatptr++;
} }
@ -378,7 +377,7 @@ Curl_cookie_add(struct SessionHandle *data,
} }
ptr=semiptr+1; ptr=semiptr+1;
while(ptr && *ptr && my_isspace(*ptr)) while(ptr && *ptr && ISBLANK(*ptr))
ptr++; ptr++;
semiptr=strchr(ptr, ';'); /* now, find the next semicolon */ semiptr=strchr(ptr, ';'); /* now, find the next semicolon */
@ -702,7 +701,7 @@ struct CookieInfo *Curl_cookie_init(struct SessionHandle *data,
lineptr=line; lineptr=line;
headerline=FALSE; headerline=FALSE;
} }
while(*lineptr && my_isspace(*lineptr)) while(*lineptr && ISBLANK(*lineptr))
lineptr++; lineptr++;
Curl_cookie_add(data, c, headerline, lineptr, NULL, NULL); Curl_cookie_add(data, c, headerline, lineptr, NULL, NULL);

View File

@ -122,6 +122,7 @@
*/ */
#define ISSPACE(x) (isspace((int) ((unsigned char)x))) #define ISSPACE(x) (isspace((int) ((unsigned char)x)))
#define ISBLANK(x) (isblank((int) ((unsigned char)x)))
#define ISDIGIT(x) (isdigit((int) ((unsigned char)x))) #define ISDIGIT(x) (isdigit((int) ((unsigned char)x)))
#define ISALNUM(x) (isalnum((int) ((unsigned char)x))) #define ISALNUM(x) (isalnum((int) ((unsigned char)x)))
#define ISXDIGIT(x) (isxdigit((int) ((unsigned char)x))) #define ISXDIGIT(x) (isxdigit((int) ((unsigned char)x)))