]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
conf nitpick: avoid warnings from clang >= 8
authorVladimír Čunát <vladimir.cunat@nic.cz>
Mon, 30 Sep 2019 10:52:20 +0000 (12:52 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Mon, 30 Sep 2019 10:54:40 +0000 (12:54 +0200)
adding 'int' to a string does not append to the string [-Wstring-plus-int]
It was only triggered on string literals, but I applied it to other
ocurrences on the same lines for better uniformity.
Tested with clang 9.0.0 - no warnings shown for me anymore.

src/knot/conf/base.c
src/knot/conf/conf.c
src/knot/conf/tools.c

index e9948393972e0d251e7631747ff79f49561f3697..de4bc6b4d523f8786051984b9134647ead6a31f2 100644 (file)
@@ -928,7 +928,7 @@ int conf_export(
                }
 
                // Export module sections before the template section.
-               if (strcmp(item->name + 1, C_TPL + 1) == 0) {
+               if (strcmp(&item->name[1], &C_TPL[1]) == 0) {
                        for (yp_item_t *mod = item + 1; mod->name != NULL; mod++) {
                                // Skip non-module sections.
                                if (strncmp(mod->name + 1, mod_prefix, mod_prefix_len) != 0) {
index 7a3c8d5b956b37aa42b261b35b8266c03b7eaf6f..82a95a9a810c364dcc7c394c09de6ec80096fa88 100644 (file)
@@ -175,7 +175,7 @@ conf_val_t conf_zone_get_txn(
                return val;
        default:
                CONF_LOG_ZONE(LOG_ERR, dname, "failed to read '%s/%s' (%s)",
-                             C_ZONE + 1, key1_name + 1, knot_strerror(val.code));
+                             &C_ZONE[1], &key1_name[1], knot_strerror(val.code));
                // FALLTHROUGH
        case KNOT_ENOENT:
                break;
@@ -191,7 +191,7 @@ conf_val_t conf_zone_get_txn(
                break;
        default:
                CONF_LOG_ZONE(LOG_ERR, dname, "failed to read '%s/%s' (%s)",
-                             C_ZONE + 1, C_TPL + 1, knot_strerror(val.code));
+                             &C_ZONE[1], &C_TPL[1], knot_strerror(val.code));
                // FALLTHROUGH
        case KNOT_ENOENT:
        case KNOT_YP_EINVAL_ID:
@@ -203,7 +203,7 @@ conf_val_t conf_zone_get_txn(
        switch (val.code) {
        default:
                CONF_LOG_ZONE(LOG_ERR, dname, "failed to read '%s/%s' (%s)",
-                             C_TPL + 1, key1_name + 1, knot_strerror(val.code));
+                             &C_TPL[1], &key1_name[1], knot_strerror(val.code));
                // FALLTHROUGH
        case KNOT_EOK:
        case KNOT_ENOENT:
@@ -232,7 +232,7 @@ conf_val_t conf_default_get_txn(
        switch (val.code) {
        default:
                CONF_LOG(LOG_ERR, "failed to read default '%s/%s' (%s)",
-                        C_TPL + 1, key1_name + 1, knot_strerror(val.code));
+                        &C_TPL[1], &key1_name[1], knot_strerror(val.code));
                // FALLTHROUGH
        case KNOT_EOK:
        case KNOT_ENOENT:
index 714fbc8ee22266678d6c8eff622a48e38e58e9ed..8000b5338157635f554c509ff4e39f4bffaa3495 100644 (file)
@@ -425,7 +425,7 @@ int check_template(
                if (val.code == KNOT_EOK) { \
                        CONF_LOG(LOG_NOTICE, "option 'template.%s' is obsolete, " \
                                             "use option 'database.%s' instead", \
-                                            old_item + 1, new_item + 1); \
+                                            &old_item[1], &new_item[1]); \
                }