]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
global: start relying on fs_deinit(NULL) and fs_unref(NULL) being no-ops
authorJosef 'Jeff' Sipek <jeff.sipek@dovecot.fi>
Fri, 25 May 2018 14:53:54 +0000 (10:53 -0400)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 13 Jun 2018 08:30:02 +0000 (11:30 +0300)
Cleanup performed with the following semantic patch:

@@
expression E;
@@

- if (E != NULL) {
-  fs_unref(&E);
- }
+ fs_unref(&E);

@@
expression E;
@@

- if (E != NULL) {
-  fs_deinit(&E);
- }
+ fs_deinit(&E);

src/lib-fs/fs-metawrap.c
src/lib-fs/fs-randomfail.c
src/lib-fs/fs-sis-queue.c
src/lib-fs/fs-sis.c
src/lib-storage/index/dbox-common/dbox-storage.c
src/plugins/fs-compress/fs-compress.c
src/plugins/mail-crypt/fs-crypt-common.c

index d12f166e9364e124b716c71b227b1f7c0be24cea..22f6dd83f3eeed6d622a656c87debbb4e1bbb0b5 100644 (file)
@@ -75,8 +75,7 @@ static void fs_metawrap_deinit(struct fs *_fs)
 {
        struct metawrap_fs *fs = (struct metawrap_fs *)_fs;
 
-       if (_fs->parent != NULL)
-               fs_deinit(&_fs->parent);
+       fs_deinit(&_fs->parent);
        i_free(fs);
 }
 
index 906fa59d13399dc2d4c7cc0c32e9e06713873ed1..87bb1ee42b43d871c1400e5a3f8d14e3839bb6f6 100644 (file)
@@ -199,8 +199,7 @@ static void fs_randomfail_deinit(struct fs *_fs)
 {
        struct randomfail_fs *fs = (struct randomfail_fs *)_fs;
 
-       if (_fs->parent != NULL)
-               fs_deinit(&_fs->parent);
+       fs_deinit(&_fs->parent);
        i_free(fs);
 }
 
index 3cf5f2cb37567178107e2e7c5a073e49048397b8..e23e9261cfff5c7116ede2464a1de27d4820510e 100644 (file)
@@ -61,8 +61,7 @@ static void fs_sis_queue_deinit(struct fs *_fs)
 {
        struct sis_queue_fs *fs = (struct sis_queue_fs *)_fs;
 
-       if (_fs->parent != NULL)
-               fs_deinit(&_fs->parent);
+       fs_deinit(&_fs->parent);
        i_free(fs->queue_dir);
        i_free(fs);
 }
index 4f76851636cc292d6375c414e53bb48ec5e21520..db8823460088a73081f3b4dd5bb02d318e4ce896 100644 (file)
@@ -72,8 +72,7 @@ static void fs_sis_deinit(struct fs *_fs)
 {
        struct sis_fs *fs = (struct sis_fs *)_fs;
 
-       if (_fs->parent != NULL)
-               fs_deinit(&_fs->parent);
+       fs_deinit(&_fs->parent);
        i_free(fs);
 }
 
index 7d1bc50a766aeaebebac00b76761c32805472dd4..a54f0a4282b178efa33a8bedb68e3ddec8c7af3b 100644 (file)
@@ -143,8 +143,7 @@ void dbox_storage_destroy(struct mail_storage *_storage)
 {
        struct dbox_storage *storage = DBOX_STORAGE(_storage);
 
-       if (storage->attachment_fs != NULL)
-               fs_deinit(&storage->attachment_fs);
+       fs_deinit(&storage->attachment_fs);
        index_storage_destroy(_storage);
 }
 
index 9b69490c5a20e289d6379ee2037c82303ef7f63f..ab2bbf159b984891d760fceeef11333926e8e49b 100644 (file)
@@ -101,8 +101,7 @@ static void fs_compress_deinit(struct fs *_fs)
 {
        struct compress_fs *fs = (struct compress_fs *)_fs;
 
-       if (_fs->parent != NULL)
-               fs_deinit(&_fs->parent);
+       fs_deinit(&_fs->parent);
        i_free(fs);
 }
 
index 38905c587c8712002968f484f5d08b5f6536e374..eb60ff137179cd830dd590f33415aac876a18730 100644 (file)
@@ -122,8 +122,7 @@ static void fs_crypt_deinit(struct fs *_fs)
        struct crypt_fs *fs = (struct crypt_fs *)_fs;
 
        mail_crypt_global_keys_free(&fs->keys);
-       if (_fs->parent != NULL)
-               fs_deinit(&_fs->parent);
+       fs_deinit(&_fs->parent);
        i_free(fs->enc_algo);
        i_free(fs->set_prefix);
        i_free(fs->public_key_path);