From ae48dc3b3caeef7eaa4a079b11cdda988d9c1f0d Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Sun, 21 Jun 2020 00:06:29 +0200 Subject: Add streq and strcaseeq and use them throughout --- config.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'config.c') diff --git a/config.c b/config.c index 30c9cde..f511dbd 100644 --- a/config.c +++ b/config.c @@ -190,7 +190,7 @@ strtosockaddrs(const char *str, struct cfg_value *rvalue, bool async) /* early list_add to make sure saddr is free():d on error */ list_add(&saddr->list, list); - if (!strcmp(str, "*")) + if (streq(str, "*")) saddr->in6.sin6_addr = in6addr_any; else if (inet_pton(AF_INET6, str, &saddr->in6.sin6_addr) <= 0) goto error; @@ -361,7 +361,7 @@ config_parse_line(struct cfg *cfg, const char *filename, char **buf, goto error; for (i = 0; kvmap[i].key_name; i++) { - if (strcmp(kvmap[i].key_name, key)) + if (!streq(kvmap[i].key_name, key)) continue; switch (kvmap[i].value_type) { @@ -424,10 +424,10 @@ config_parse_line(struct cfg *cfg, const char *filename, char **buf, break; case CFG_VAL_TYPE_BOOL: - if (!strcasecmp(tmp, "yes") || !strcasecmp(tmp, "true")) { + if (strcaseeq(tmp, "yes") || strcaseeq(tmp, "true")) { rvalue->type = CFG_VAL_TYPE_BOOL; rvalue->boolean = true; - } else if (!strcasecmp(tmp, "no") || !strcasecmp(tmp, "false")) { + } else if (strcaseeq(tmp, "no") || strcaseeq(tmp, "false")) { rvalue->type = CFG_VAL_TYPE_BOOL; rvalue->boolean = false; } else { @@ -483,7 +483,7 @@ config_parse_header(struct cfg *cfg, const char *filename, const char *title, char titlehdr[strlen(title) + 3]; sprintf(titlehdr, "[%s]", title); - if (strcmp(line, titlehdr)) { + if (!streq(line, titlehdr)) { error("%s: incorrect header in configuration file", filename); return false; } -- cgit v1.2.3