You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by mt...@apache.org on 2012/03/27 10:16:32 UTC
svn commit: r1305771 - in /tomcat/jk/trunk/native/common: jk_ajp12_worker.c
jk_connect.c jk_lb_worker.c jk_map.c jk_shm.c jk_url.c jk_util.h
Author: mturk
Date: Tue Mar 27 08:16:32 2012
New Revision: 1305771
URL: http://svn.apache.org/viewvc?rev=1305771&view=rev
Log:
Unify ctype's isxxx as global macros instead those cryptic casts all over the place. No functional change
Modified:
tomcat/jk/trunk/native/common/jk_ajp12_worker.c
tomcat/jk/trunk/native/common/jk_connect.c
tomcat/jk/trunk/native/common/jk_lb_worker.c
tomcat/jk/trunk/native/common/jk_map.c
tomcat/jk/trunk/native/common/jk_shm.c
tomcat/jk/trunk/native/common/jk_url.c
tomcat/jk/trunk/native/common/jk_util.h
Modified: tomcat/jk/trunk/native/common/jk_ajp12_worker.c
URL: http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_ajp12_worker.c?rev=1305771&r1=1305770&r2=1305771&view=diff
==============================================================================
--- tomcat/jk/trunk/native/common/jk_ajp12_worker.c (original)
+++ tomcat/jk/trunk/native/common/jk_ajp12_worker.c Tue Mar 27 08:16:32 2012
@@ -560,7 +560,7 @@ static int ajpv12_handle_response(ajp12_
}
name = line;
- while (isspace((int)(*name)) && *name) {
+ while (jk_isspace(*name) && *name) {
name++; /* Skip leading white chars */
}
if (!*name) { /* Empty header name */
@@ -575,7 +575,7 @@ static int ajpv12_handle_response(ajp12_
}
*value = '\0';
value++;
- while (isspace((int)(*value)) && *value) {
+ while (jk_isspace(*value) && *value) {
value++; /* Skip leading white chars */
}
if (!*value) { /* Empty header value */
Modified: tomcat/jk/trunk/native/common/jk_connect.c
URL: http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_connect.c?rev=1305771&r1=1305770&r2=1305771&view=diff
==============================================================================
--- tomcat/jk/trunk/native/common/jk_connect.c (original)
+++ tomcat/jk/trunk/native/common/jk_connect.c Tue Mar 27 08:16:32 2012
@@ -339,7 +339,7 @@ int jk_resolve(const char *host, int por
/* Check if we only have digits in the string */
for (x = 0; host[x] != '\0'; x++) {
- if (!isdigit((int)(host[x])) && host[x] != '.') {
+ if (!jk_isdigit(host[x]) && host[x] != '.') {
break;
}
}
Modified: tomcat/jk/trunk/native/common/jk_lb_worker.c
URL: http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_lb_worker.c?rev=1305771&r1=1305770&r2=1305771&view=diff
==============================================================================
--- tomcat/jk/trunk/native/common/jk_lb_worker.c (original)
+++ tomcat/jk/trunk/native/common/jk_lb_worker.c Tue Mar 27 08:16:32 2012
@@ -447,9 +447,9 @@ static char *get_cookie(jk_ws_service_t
id_start; id_start = strstr(id_start + 1, name)) {
if (id_start == s->headers_values[i] ||
id_start[-1] == ';' ||
- id_start[-1] == ',' || isspace((int)id_start[-1])) {
+ id_start[-1] == ',' || jk_isspace(id_start[-1])) {
id_start += strlen(name);
- while (*id_start && isspace((int)(*id_start)))
+ while (*id_start && jk_isspace(*id_start))
++id_start;
if (*id_start == '=' && id_start[1]) {
/*
Modified: tomcat/jk/trunk/native/common/jk_map.c
URL: http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_map.c?rev=1305771&r1=1305770&r2=1305771&view=diff
==============================================================================
--- tomcat/jk/trunk/native/common/jk_map.c (original)
+++ tomcat/jk/trunk/native/common/jk_map.c Tue Mar 27 08:16:32 2012
@@ -636,8 +636,8 @@ static size_t trim(char *s)
if (!(len = strlen(s)))
return 0;
for (len = len - 1; (len > 0) &&
- isspace((int)((unsigned char)s[len])); len--);
- if ((len > 0) || !isspace((int)((unsigned char)s[len]))) {
+ jk_isspace(s[len]); len--);
+ if ((len > 0) || !jk_isspace(s[len])) {
len++;
}
@@ -645,7 +645,7 @@ static size_t trim(char *s)
len++;
for (first = 0; (s[first] != '\0') &&
- isspace((int)((unsigned char)s[first])); first++);
+ jk_isspace(s[first]); first++);
if (first > 0) {
memmove(s, s + first, len - first);
Modified: tomcat/jk/trunk/native/common/jk_shm.c
URL: http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_shm.c?rev=1305771&r1=1305770&r2=1305771&view=diff
==============================================================================
--- tomcat/jk/trunk/native/common/jk_shm.c (original)
+++ tomcat/jk/trunk/native/common/jk_shm.c Tue Mar 27 08:16:32 2012
@@ -178,7 +178,7 @@ int jk_shm_open(const char *fname, size_
strcpy(shname, "Global\\");
strncat(shname, fname, MAX_PATH - 8);
for(i = 7; i < (int)strlen(shname); i++) {
- if (!isalnum((unsigned char)shname[i]))
+ if (!jk_isalnum(shname[i]))
shname[i] = '_';
else
shname[i] = toupper(shname[i]);
Modified: tomcat/jk/trunk/native/common/jk_url.c
URL: http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_url.c?rev=1305771&r1=1305770&r2=1305771&view=diff
==============================================================================
--- tomcat/jk/trunk/native/common/jk_url.c (original)
+++ tomcat/jk/trunk/native/common/jk_url.c Tue Mar 27 08:16:32 2012
@@ -23,18 +23,6 @@
#include "jk_global.h"
#include "jk_url.h"
-#ifdef HAVE_APR
-#define JK_ISXDIGIT(x) apr_isxdigit((x))
-#define JK_ISDIGIT(x) apr_isdigit((x))
-#define JK_ISUPPER(x) apr_isupper((x))
-#define JK_ISALNUM(x) apr_isalnum((x))
-#else
-#define JK_ISXDIGIT(x) isxdigit((int)(unsigned char)((x)))
-#define JK_ISDIGIT(x) isdigit((int)(unsigned char)((x)))
-#define JK_ISUPPER(x) isupper((int)(unsigned char)((x)))
-#define JK_ISALNUM(x) isalnum((int)(unsigned char)((x)))
-#endif
-
static void jk_c2hex(int ch, char *x)
{
#if !CHARSET_EBCDIC
@@ -101,7 +89,7 @@ int jk_canonenc(const char *x, char *y,
continue;
}
/* recode it, if necessary */
- if (!JK_ISALNUM(ch) && !strchr(allowed, ch)) {
+ if (!jk_isalnum(ch) && !strchr(allowed, ch)) {
if (j+2<maxlen) {
jk_c2hex(ch, &y[j]);
j += 2;
Modified: tomcat/jk/trunk/native/common/jk_util.h
URL: http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_util.h?rev=1305771&r1=1305770&r2=1305771&view=diff
==============================================================================
--- tomcat/jk/trunk/native/common/jk_util.h (original)
+++ tomcat/jk/trunk/native/common/jk_util.h Tue Mar 27 08:16:32 2012
@@ -266,6 +266,12 @@ int jk_stat(const char *f, struct stat *
PSECURITY_ATTRIBUTES jk_get_sa_with_null_dacl(void);
#endif
+#define jk_isspace(c) (isspace(((unsigned char)(c))))
+#define jk_isalnum(c) (isalnum(((unsigned char)(c))))
+#define jk_isdigit(c) (isdigit(((unsigned char)(c))))
+#define jk_isalpha(c) (isalpha(((unsigned char)(c))))
+#define jk_islower(c) (islower(((unsigned char)(c))))
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org