]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
global: Remove/fix dead code
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 16 Jan 2025 11:11:40 +0000 (13:11 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 12 Feb 2025 10:34:16 +0000 (12:34 +0200)
Found by scan-build

src/auth/passdb-ldap.c
src/auth/userdb-ldap.c
src/lib-lua/dlua-dovecot-http.c
src/lib-lua/test-lua-http-client.c
src/lib-settings/settings.c
src/lib-sql/driver-sqlpool.c
src/lib-var-expand/expansion-program.c

index b2a21d8571536e8fa2d44d89d2a9264f2d3b0fa3..a71da1045507e9d4a748d55de1323c43bb66f5bd 100644 (file)
@@ -437,7 +437,6 @@ static int passdb_ldap_preinit(pool_t pool, struct event *event,
        const struct auth_passdb_post_settings *auth_post = NULL;
        const struct ldap_pre_settings *ldap_pre = NULL;
        struct ldap_passdb_module *module;
-       struct ldap_connection *conn;
        int ret = -1;
 
        if (settings_get(event, &auth_passdb_post_setting_parser_info,
@@ -448,7 +447,7 @@ static int passdb_ldap_preinit(pool_t pool, struct event *event,
                goto failed;
 
        module = p_new(pool, struct ldap_passdb_module, 1);
-       module->conn = conn = db_ldap_init(event);
+       module->conn = db_ldap_init(event);
 
        db_ldap_get_attribute_names(pool, &auth_post->fields,
                                    &module->attributes,
index 8f49eb691ecec64dc9912985780cec5ef501afc3..6afa4ab51074e4170ed04755892a6b8d8c8d951b 100644 (file)
@@ -320,7 +320,6 @@ static int userdb_ldap_preinit(pool_t pool, struct event *event,
        const struct ldap_post_settings *ldap_post = NULL;
        const struct ldap_pre_settings *ldap_pre = NULL;
        struct ldap_userdb_module *module;
-       struct ldap_connection *conn;
        int ret = -1;
 
        if (settings_get(event, &auth_userdb_post_setting_parser_info,
@@ -334,7 +333,7 @@ static int userdb_ldap_preinit(pool_t pool, struct event *event,
                goto failed;
 
        module = p_new(pool, struct ldap_userdb_module, 1);
-       module->conn = conn = db_ldap_init(event);
+       module->conn = db_ldap_init(event);
 
        db_ldap_get_attribute_names(pool, &auth_post->fields,
                                    &module->attributes,
index 20bfaca991232a6cba8368f993a1f4bff59f635c..3b7b01bf9e6e8b5f9ea3cccc970c76f37d632a0d 100644 (file)
@@ -435,7 +435,7 @@ static int parse_client_settings(lua_State *L, struct settings_instance *instanc
        while (*error_r == NULL && lua_next(L, -2) != 0) {
                const char *key = lua_tostring(L, -2);
                const char *value = lua_tostring(L, -1);
-               const char *real_key = key;
+               const char *real_key;
                unsigned int idx ATTR_UNUSED;
                /* ignore event_parent */
                if (strcmp(key, "event_parent") == 0) {
index 9ff3ea99b55f2d9fd301bded5fa0b13580458433..37cf91bc1d7444e4723da1f02ad825be6793b94d 100644 (file)
@@ -417,9 +417,9 @@ static void test_bad_settings(void)
 
        /* This needs a bit more roundabout way to check this as SSL settings
           are lazily evaluated. */
-       ret = dlua_pcall(script->L, "test_invalid_set_value_3", 0, 0, &error);
+       test_assert(dlua_pcall(script->L, "test_invalid_set_value_3", 0, 0, &error) == 0);
        lua_pushstring(script->L, "https://localhost");
-       ret = dlua_pcall(script->L, "http_request_post", 1, 2, &error);
+       test_assert(dlua_pcall(script->L, "http_request_post", 1, 2, &error) == 2);
        error = lua_tostring(script->L, 2);
        test_assert_strcmp(error, "Couldn't initialize SSL client context: Can't set minimum protocol to 'cow' (ssl_min_protocol setting): Unknown value");
 
index 646beb67d74db051d49dfad5f44ccf5e8650c16a..681823b5a23c5a8395512823a1c7a158da4643c0 100644 (file)
@@ -2422,7 +2422,7 @@ settings_get_full(struct event *event,
                return 1;
        }
 
-       const struct setting_define *def = info->defines;
+       const struct setting_define *def;
 
        /* Sort filter arrays when order is defined */
        for (def = info->defines; def->key != NULL; def++) {
index a2bf86900c9cac4298da6d480e0957dd51efa570..3027b1532c4595bf1f636740291e377e665cde69 100644 (file)
@@ -479,7 +479,7 @@ driver_sqlpool_init_common(const struct sql_db *driver,
 
        if (array_count(hostnames) == 0) {
                /* no hosts specified. create a default one. */
-               host = array_append_space(&db->hosts);
+               array_append_zero(&db->hosts);
        } else {
                array_foreach_elem(hostnames, hostname) {
                        host = array_append_space(&db->hosts);
index 0b761e541a6f5c14a26e42ae356f4c911d6e9289..5f64b5bda6247d0eb455a9419944399e44309ce6 100644 (file)
@@ -228,7 +228,6 @@ static void var_expand_program_export_one(const struct var_expand_program *progr
                str_append(dest, stmt->function);
                str_append_c(dest, '\1');
                const struct var_expand_parameter *param = stmt->params;
-               param = stmt->params;
                while (param != NULL) {
                        if (param->key != NULL)
                                str_append(dest, param->key);