aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-10-03 21:02:01 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-10-03 21:02:01 +0000
commitbe7ce435c036f893f6ce04c91d1cbec006a810e5 (patch)
tree8d7a41717e718d3ecda794958d29cfbfd5916b49
parentf4252f86729f328235379231f36d75e0c80e8d80 (diff)
Replaced the use of isspace() with our own version instead since we have most
data as 'char *' and that makes us pass in negative values if there is 8bit data in the string. Changing to unsigned causes too much warnings or too many required typecasts to the normal string functions.
-rw-r--r--lib/cookie.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/cookie.c b/lib/cookie.c
index b7a2237a3..47ed95254 100644
--- a/lib/cookie.c
+++ b/lib/cookie.c
@@ -84,7 +84,6 @@ Example set of cookies:
#include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include "urldata.h"
#include "cookie.h"
@@ -98,6 +97,8 @@ Example set of cookies:
#include "memdebug.h"
#endif
+#define my_isspace(x) ((x == ' ') || (x == '\t'))
+
static void freecookie(struct Cookie *co)
{
if(co->expirestr)
@@ -175,7 +176,7 @@ Curl_cookie_add(struct SessionHandle *data,
semiptr=strchr(lineptr, ';'); /* first, find a semicolon */
- while(*lineptr && isspace((int)*lineptr))
+ while(*lineptr && my_isspace(*lineptr))
lineptr++;
ptr = lineptr;
@@ -198,14 +199,14 @@ Curl_cookie_add(struct SessionHandle *data,
/* Strip off trailing whitespace from the 'what' */
size_t len=strlen(what);
- while(len && isspace((int)what[len-1])) {
+ while(len && my_isspace(what[len-1])) {
what[len-1]=0;
len--;
}
/* Skip leading whitespace from the 'what' */
whatptr=what;
- while(isspace((int)*whatptr)) {
+ while(my_isspace(*whatptr)) {
whatptr++;
}
@@ -347,7 +348,7 @@ Curl_cookie_add(struct SessionHandle *data,
}
ptr=semiptr+1;
- while(ptr && *ptr && isspace((int)*ptr))
+ while(ptr && *ptr && my_isspace(*ptr))
ptr++;
semiptr=strchr(ptr, ';'); /* now, find the next semicolon */
@@ -667,7 +668,7 @@ struct CookieInfo *Curl_cookie_init(struct SessionHandle *data,
lineptr=line;
headerline=FALSE;
}
- while(*lineptr && isspace((int)*lineptr))
+ while(*lineptr && my_isspace(*lineptr))
lineptr++;
Curl_cookie_add(data, c, headerline, lineptr, NULL, NULL);