]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: server-state: avoid using not-so-portable isblank()
authorWilly Tarreau <w@1wt.eu>
Fri, 28 Jan 2022 08:32:43 +0000 (09:32 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 28 Jan 2022 18:04:02 +0000 (19:04 +0100)
Once in a while we get rid of this one. isblank() is missing on old
C libraries and only matches two values, so let's just replace it.
It was brought with this commit in 2.4:

  0bf268e18 ("MINOR: server: Be more strict on the server-state line parsing")

It may be backported though it's really not important.

src/server_state.c

index dcbbe41a050fe9223433fba0da45c61bf3dfe400..285d23e3a8de1e1f0c4ca13932ccd66e4bd1a831 100644 (file)
@@ -571,7 +571,7 @@ static int srv_state_parse_line(char *buf, const int version, char **params)
        }
 
        /* skip blank characters at the beginning of the line */
-       while (isblank((unsigned char)*cur))
+       while (*cur == ' ' || *cur == '\t')
                ++cur;
 
        /* ignore empty or commented lines */
@@ -592,7 +592,7 @@ static int srv_state_parse_line(char *buf, const int version, char **params)
                        break;
 
                /* then skip leading spaces */
-               while (*cur && isblank((unsigned char)*cur)) {
+               while (*cur && (*cur == ' ' || *cur == '\t')) {
                        ++cur;
                        if (!*cur)
                                break;
@@ -632,7 +632,7 @@ static int srv_state_parse_line(char *buf, const int version, char **params)
                params[arg++] = cur;
 
                /* look for the end of the current field */
-               while (*cur && !isblank((unsigned char)*cur)) {
+               while (*cur && *cur != ' ' && *cur != '\t') {
                        ++cur;
                        if (!*cur)
                                break;