|
5 | 5 |
|
6 | 6 | #include <arpa/inet.h> |
7 | 7 | #include <limits.h> |
8 | | -#include <ctype.h> |
9 | 8 | #include <netdb.h> |
10 | 9 | #include <stdio.h> |
11 | 10 | #include <stdlib.h> |
|
19 | 18 | #include "containers.h" |
20 | 19 | #include "ipc.h" |
21 | 20 | #include "encoding.h" |
| 21 | +#include "ctype.h" |
22 | 22 |
|
23 | 23 | #define COMMENT_CHAR '#' |
24 | 24 |
|
@@ -86,7 +86,7 @@ static inline bool parse_fwmark(uint32_t *fwmark, uint32_t *flags, const char *v |
86 | 86 | return true; |
87 | 87 | } |
88 | 88 |
|
89 | | - if (!isdigit(value[0])) |
| 89 | + if (!char_is_digit(value[0])) |
90 | 90 | goto err; |
91 | 91 |
|
92 | 92 | if (strlen(value) > 2 && value[0] == '0' && value[1] == 'x') |
@@ -141,7 +141,7 @@ static bool parse_keyfile(uint8_t key[static WG_KEY_LEN], const char *path) |
141 | 141 | dst[WG_KEY_LEN_BASE64 - 1] = '\0'; |
142 | 142 |
|
143 | 143 | while ((c = getc(f)) != EOF) { |
144 | | - if (!isspace(c)) { |
| 144 | + if (!char_is_space(c)) { |
145 | 145 | fprintf(stderr, "Found trailing character in key file: `%c'\n", c); |
146 | 146 | goto out; |
147 | 147 | } |
@@ -290,7 +290,7 @@ static inline bool parse_persistent_keepalive(uint16_t *interval, uint32_t *flag |
290 | 290 | return true; |
291 | 291 | } |
292 | 292 |
|
293 | | - if (!isdigit(value[0])) |
| 293 | + if (!char_is_digit(value[0])) |
294 | 294 | goto err; |
295 | 295 |
|
296 | 296 | ret = strtoul(value, &end, 10); |
@@ -375,7 +375,7 @@ static inline bool parse_allowedips(struct wgpeer *peer, struct wgallowedip **la |
375 | 375 | } |
376 | 376 |
|
377 | 377 | if (mask) { |
378 | | - if (!isdigit(mask[0])) |
| 378 | + if (!char_is_digit(mask[0])) |
379 | 379 | goto err; |
380 | 380 | cidr = strtoul(mask, &end, 10); |
381 | 381 | if (*end || (cidr > 32 && new_allowedip->family == AF_INET) || (cidr > 128 && new_allowedip->family == AF_INET6)) |
@@ -501,7 +501,7 @@ bool config_read_line(struct config_ctx *ctx, const char *input) |
501 | 501 | } |
502 | 502 |
|
503 | 503 | for (size_t i = 0; i < len; ++i) { |
504 | | - if (!isspace(input[i])) |
| 504 | + if (!char_is_space(input[i])) |
505 | 505 | line[cleaned_len++] = input[i]; |
506 | 506 | } |
507 | 507 | if (!cleaned_len) |
@@ -555,7 +555,7 @@ static char *strip_spaces(const char *in) |
555 | 555 | return NULL; |
556 | 556 | } |
557 | 557 | for (i = 0, l = 0; i < t; ++i) { |
558 | | - if (!isspace(in[i])) |
| 558 | + if (!char_is_space(in[i])) |
559 | 559 | out[l++] = in[i]; |
560 | 560 | } |
561 | 561 | return out; |
|
0 commit comments