]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: log: fix build warning on Solaris
authorWilly Tarreau <w@1wt.eu>
Mon, 16 Dec 2013 00:38:33 +0000 (01:38 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 16 Dec 2013 01:23:51 +0000 (02:23 +0100)
The is* macros must not use a char on Solaris. Unsigned char is OK.
Casting char to int is wrong as well since we get a negative value.

  src/log.c: In function `parse_logformat_string':
  src/log.c:454: warning: subscript has type `char'

src/log.c

index 5cfd17e757a3840f2855ef34d092a8df6d2f217a..f2ba621c5431f7b08c5e09270c80de88da9a3439 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -445,13 +445,13 @@ void parse_logformat_string(const char *fmt, struct proxy *curproxy, struct list
                                cformat = LF_STEXPR;
                                var = str + 1;         // store expr in variable name
                        }
-                       else if (isalpha((int)*str)) { // variable name
+                       else if (isalpha((unsigned char)*str)) { // variable name
                                cformat = LF_VAR;
                                var = str;
                        }
                        else if (*str == '%')
                                cformat = LF_TEXT;     // convert this character to a litteral (useful for '%')
-                       else if (isdigit(*str) || *str == ' ' || *str == '\t') {
+                       else if (isdigit((unsigned char)*str) || *str == ' ' || *str == '\t') {
                                /* single '%' followed by blank or digit, send them both */
                                cformat = LF_TEXT;
                                pformat = LF_TEXT; /* finally we include the previous char as well */
@@ -478,7 +478,7 @@ void parse_logformat_string(const char *fmt, struct proxy *curproxy, struct list
                                var = str + 1;         // store expr in variable name
                                break;
                        }
-                       else if (isalnum((int)*str)) { // variable name
+                       else if (isalnum((unsigned char)*str)) { // variable name
                                cformat = LF_VAR;
                                var = str;
                                break;
@@ -498,7 +498,7 @@ void parse_logformat_string(const char *fmt, struct proxy *curproxy, struct list
 
                case LF_VAR:                           // text part of a variable name
                        var_len = str - var;
-                       if (!isalnum((int)*str))
+                       if (!isalnum((unsigned char)*str))
                                cformat = LF_INIT;     // not variable name anymore
                        break;