]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
global: start relying on fs_file_close(NULL) being a no-op
authorJosef 'Jeff' Sipek <jeff.sipek@dovecot.fi>
Fri, 25 May 2018 14:38:36 +0000 (10:38 -0400)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 13 Jun 2018 07:25:37 +0000 (07:25 +0000)
Cleanup performed with the following semantic patch:

@@
expression E;
@@

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

src/lib-fs/fs-metawrap.c
src/plugins/fs-compress/fs-compress.c
src/plugins/mail-crypt/fs-crypt-common.c

index ca54183165d9edfb1be952760dd40d619207ce1f..d12f166e9364e124b716c71b227b1f7c0be24cea 100644 (file)
@@ -146,10 +146,8 @@ static void fs_metawrap_file_close(struct fs_file *_file)
        struct metawrap_fs_file *file = (struct metawrap_fs_file *)_file;
 
        i_stream_unref(&file->input);
-       if (file->super_read != NULL)
-               fs_file_close(file->super_read);
-       if (_file->parent != NULL)
-               fs_file_close(_file->parent);
+       fs_file_close(file->super_read);
+       fs_file_close(_file->parent);
 }
 
 static void
index aae057c13d7fafcb98ef0fca589f685393b174da..9b69490c5a20e289d6379ee2037c82303ef7f63f 100644 (file)
@@ -154,10 +154,8 @@ static void fs_compress_file_close(struct fs_file *_file)
        struct compress_fs_file *file = (struct compress_fs_file *)_file;
 
        i_stream_unref(&file->input);
-       if (file->super_read != NULL)
-               fs_file_close(file->super_read);
-       if (_file->parent != NULL)
-               fs_file_close(_file->parent);
+       fs_file_close(file->super_read);
+       fs_file_close(_file->parent);
 }
 
 static struct istream *
index dca59c28b71a5d0e95750b031f1733b1a0b15ab2..38905c587c8712002968f484f5d08b5f6536e374 100644 (file)
@@ -180,10 +180,8 @@ static void fs_crypt_file_close(struct fs_file *_file)
        struct crypt_fs_file *file = (struct crypt_fs_file *)_file;
 
        i_stream_unref(&file->input);
-       if (file->super_read != NULL)
-               fs_file_close(file->super_read);
-       if (_file->parent != NULL)
-               fs_file_close(_file->parent);
+       fs_file_close(file->super_read);
+       fs_file_close(_file->parent);
 }
 
 static int fs_crypt_read_file(const char *set_name, const char *path,