]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
global: hash_table_destroy(NULL) is a no-op
authorJosef 'Jeff' Sipek <jeff.sipek@open-xchange.com>
Thu, 17 Jan 2019 16:09:13 +0000 (11:09 -0500)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Thu, 21 Mar 2019 08:02:33 +0000 (10:02 +0200)
@@
expression E;
@@

- if (hash_table_is_created(E))
-  hash_table_destroy(&E);
+ hash_table_destroy(&E);

src/auth/db-passwd-file.c
src/doveadm/dsync/dsync-mailbox-tree.c
src/lib-fts/fts-filter-stopwords.c
src/lib-master/master-service-settings-cache.c
src/lib-storage/index/maildir/maildir-uidlist.c
src/plugins/lazy-expunge/lazy-expunge-plugin.c

index 194ce84d36e0602eaa7e10d24671297aa58b6b4f..b5c7a362c662a842277692173978c7a7a7adc652 100644 (file)
@@ -236,8 +236,7 @@ static void passwd_file_close(struct passwd_file *pw)
 {
        i_close_fd_path(&pw->fd, pw->path);
 
-       if (hash_table_is_created(pw->users))
-               hash_table_destroy(&pw->users);
+       hash_table_destroy(&pw->users);
        pool_unref(&pw->pool);
 }
 
index d9fd7c34708412b3416d449fadb10f6a83e512d6..5d0b9a96713e3ca89296b5edb7ec2adcfea09235 100644 (file)
@@ -38,10 +38,8 @@ void dsync_mailbox_tree_deinit(struct dsync_mailbox_tree **_tree)
        struct dsync_mailbox_tree *tree = *_tree;
 
        *_tree = NULL;
-       if (hash_table_is_created(tree->name128_hash))
-               hash_table_destroy(&tree->name128_hash);
-       if (hash_table_is_created(tree->guid_hash))
-               hash_table_destroy(&tree->guid_hash);
+       hash_table_destroy(&tree->name128_hash);
+       hash_table_destroy(&tree->guid_hash);
        array_free(&tree->deletes);
        pool_unref(&tree->pool);
 }
index 83ecdf3b482a6cdea15d5cc75e56421c6fab09ef..3440cfe0ab57f1cd216d73c2226d39022092ca6c 100644 (file)
@@ -61,8 +61,7 @@ static void fts_filter_stopwords_destroy(struct fts_filter *filter)
 {
        struct fts_filter_stopwords *sp = (struct fts_filter_stopwords *)filter;
 
-       if (hash_table_is_created(sp->stopwords))
-               hash_table_destroy(&sp->stopwords);
+       hash_table_destroy(&sp->stopwords);
        pool_unref(&sp->pool);
 }
 
index 3126f1127d65e71332ed8331aa18e430e7502407..53210a89daec6172d93b161936db98a3e22c8eb7 100644 (file)
@@ -188,10 +188,8 @@ void master_service_settings_cache_deinit(struct master_service_settings_cache *
                settings_parser_deinit(&entry->parser);
                pool_unref(&entry->pool);
        }
-       if (hash_table_is_created(cache->local_name_hash))
-               hash_table_destroy(&cache->local_name_hash);
-       if (hash_table_is_created(cache->local_ip_hash))
-               hash_table_destroy(&cache->local_ip_hash);
+       hash_table_destroy(&cache->local_name_hash);
+       hash_table_destroy(&cache->local_ip_hash);
        if (cache->global_parser != NULL)
                settings_parser_deinit(&cache->global_parser);
        pool_unref(&cache->pool);
index eb9d97222b1061dcfa9ec010d229a7db2f5fd7ce..100be14bd02f449d3a39feecd97bf3eaf94d6895 100644 (file)
@@ -2054,8 +2054,7 @@ int maildir_uidlist_sync_deinit(struct maildir_uidlist_sync_ctx **_ctx,
        if (ctx->locked)
                maildir_uidlist_unlock(ctx->uidlist);
 
-       if (hash_table_is_created(ctx->files))
-               hash_table_destroy(&ctx->files);
+       hash_table_destroy(&ctx->files);
        pool_unref(&ctx->record_pool);
        if (array_is_created(&ctx->records))
                array_free(&ctx->records);
index ee5093d69d48ff7940863133ff961b641076c855..c2b65b339bba881958d6db44d7c30e3546a069af 100644 (file)
@@ -404,8 +404,7 @@ static void lazy_expunge_transaction_free(struct lazy_expunge_transaction *lt)
                mailbox_transaction_rollback(&lt->dest_trans);
        if (lt->dest_box != NULL)
                mailbox_free(&lt->dest_box);
-       if (hash_table_is_created(lt->guids))
-               hash_table_destroy(&lt->guids);
+       hash_table_destroy(&lt->guids);
        pool_unref(&lt->pool);
        i_free(lt->delayed_errstr);
        i_free(lt->delayed_internal_errstr);