Skip to content

Commit

Permalink
global: start relying on fs_file_deinit(NULL) being a no-op
Browse files Browse the repository at this point in the history
Cleanup performed with the following semantic patch:

	@@
	expression E;
	@@

	- if (E != NULL) {
	- 	fs_file_deinit(&E);
	- }
	+ fs_file_deinit(&E);
  • Loading branch information
Josef 'Jeff' Sipek authored and sirainen committed Jun 13, 2018
1 parent 1482971 commit f7fac54
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 7 deletions.
3 changes: 1 addition & 2 deletions src/doveadm/doveadm-fs.c
Expand Up @@ -323,8 +323,7 @@ static void doveadm_fs_delete_async_finish(struct fs_delete_ctx *ctx)
fs_wait_async(ctx->fs);
}
for (i = 0; i < ctx->files_count; i++) {
if (ctx->files[i] != NULL)
fs_file_deinit(&ctx->files[i]);
fs_file_deinit(&ctx->files[i]);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib-fs/fs-metawrap.c
Expand Up @@ -133,7 +133,7 @@ static void fs_metawrap_file_deinit(struct fs_file *_file)
{
struct metawrap_fs_file *file = (struct metawrap_fs_file *)_file;

if (file->super_read != _file->parent && file->super_read != NULL)
if (file->super_read != _file->parent)
fs_file_deinit(&file->super_read);
str_free(&file->metadata_header);
fs_file_deinit(&_file->parent);
Expand Down
3 changes: 1 addition & 2 deletions src/lib-fs/fs-sis-queue.c
Expand Up @@ -93,8 +93,7 @@ static void fs_sis_queue_file_deinit(struct fs_file *_file)
{
struct sis_queue_fs_file *file = (struct sis_queue_fs_file *)_file;

if (_file->parent != NULL)
fs_file_deinit(&_file->parent);
fs_file_deinit(&_file->parent);
i_free(file->file.path);
i_free(file);
}
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/fs-compress/fs-compress.c
Expand Up @@ -142,7 +142,7 @@ static void fs_compress_file_deinit(struct fs_file *_file)
{
struct compress_fs_file *file = (struct compress_fs_file *)_file;

if (file->super_read != _file->parent && file->super_read != NULL)
if (file->super_read != _file->parent)
fs_file_deinit(&file->super_read);
fs_file_deinit(&_file->parent);
i_free(file->file.path);
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/mail-crypt/fs-crypt-common.c
Expand Up @@ -168,7 +168,7 @@ static void fs_crypt_file_deinit(struct fs_file *_file)
{
struct crypt_fs_file *file = (struct crypt_fs_file *)_file;

if (file->super_read != _file->parent && file->super_read != NULL)
if (file->super_read != _file->parent)
fs_file_deinit(&file->super_read);
fs_file_deinit(&_file->parent);
i_free(file->file.path);
Expand Down

0 comments on commit f7fac54

Please sign in to comment.