From 78c3cebc389a2b0d426d74900a65b8656edb426d Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Mon, 26 Oct 2026 18:13:27 +0100 Subject: Third run of making variable and function names more readable, integer scans and ip parsers --- ot_config.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'ot_config.c') diff --git a/ot_config.c b/ot_config.c index a5fc06e..32625bd 100644 --- a/ot_config.c +++ b/ot_config.c @@ -107,7 +107,7 @@ static int listen_scan_options(char *p, int *shared, int *workers) { *shared = 1; break; case LISTEN_OPTION_WORKERS: { - size_t off = scan_udec(p, &value, UINT_MAX); + size_t off = scan_uint(p, &value, UINT_MAX); if (!off) return 0; @@ -140,7 +140,7 @@ static int scan_ip6_port(const char *src, ot_ip6 ip, uint16_t *port) { ++s; if (*s == '[') ++s, ++bracket; /* for v6 style notation */ - if (!(off = ip_scan(s, ip))) + if (!(off = ip_parse(s, ip))) return 0; s += off; if (bracket && *s == ']') @@ -157,7 +157,7 @@ static int scan_ip6_port(const char *src, ot_ip6 ip, uint16_t *port) { if (*(s++) != ':') return 0; } - if (!(off = scan_udec(s, &value, 65535))) + if (!(off = scan_uint(s, &value, 65535))) return 0; *port = (uint16_t)value; return off + s - src; @@ -169,14 +169,14 @@ static int scan_ip6_net(const char *src, ot_net *net) { int off; while (isspace(*s)) ++s; - if (!(off = ip_scan(s, net->address))) + if (!(off = ip_parse(s, net->address))) return 0; s += off; if (*s != '/') net->bits = 128; else { s++; - if (!(off = scan_udec(s, &value, 128))) + if (!(off = scan_uint(s, &value, 128))) return 0; net->bits = (int)value; if (ip_is_v4mapped(net->address)) @@ -324,12 +324,12 @@ static int parse_configfile(char *config_filename) { break; } case CONFIG_LISTEN_UDP_WORKERS: - if (!scan_udec(p, &value, UINT_MAX)) + if (!scan_uint(p, &value, UINT_MAX)) goto parse_error; g_listen_workers = (int)value; break; case CONFIG_LISTEN_SHARED: - if (!scan_udec(p, &value, 1)) + if (!scan_uint(p, &value, 1)) goto parse_error; g_listen_shared = (int)value; break; @@ -479,7 +479,7 @@ void config_parse(int argc, char **argv) { scanon = 0; break; case 'i': - if (!ip_scan(optarg, serverip)) { + if (!ip_parse(optarg, serverip)) { usage(argv[0]); exit(1); } @@ -494,7 +494,7 @@ void config_parse(int argc, char **argv) { break; #endif case 'p': - if (!scan_udec(optarg, &value, 65535)) { + if (!scan_uint(optarg, &value, 65535)) { usage(argv[0]); exit(1); } @@ -502,7 +502,7 @@ void config_parse(int argc, char **argv) { bound++; break; case 'P': - if (!scan_udec(optarg, &value, 65535)) { + if (!scan_uint(optarg, &value, 65535)) { usage(argv[0]); exit(1); } @@ -511,7 +511,7 @@ void config_parse(int argc, char **argv) { break; #ifdef WANT_SYNC_LIVE case 's': - if (!scan_udec(optarg, &value, 65535)) { + if (!scan_uint(optarg, &value, 65535)) { usage(argv[0]); exit(1); } -- cgit v1.3