dovecot-2.2: Avoid using (void)s by adding ATTR_NOWARN_UNUSED_RE...

dovecot at dovecot.org dovecot at dovecot.org
Wed Jun 27 04:26:17 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/128c598d2870
changeset: 14688:128c598d2870
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Jun 25 03:21:25 2012 +0300
description:
Avoid using (void)s by adding ATTR_NOWARN_UNUSED_RESULT attributes and other ways.

diffstat:

 src/auth/auth-worker-server.h                   |   2 +-
 src/auth/passdb-blocking.c                      |  11 ++++----
 src/auth/userdb-blocking.c                      |   2 +-
 src/doveadm/doveadm-mail-expunge.c              |   2 +-
 src/doveadm/doveadm-mail.c                      |   2 +-
 src/doveadm/dsync/dsync-brain-mailbox-tree.c    |   4 +-
 src/doveadm/dsync/dsync-brain-mailbox.c         |   6 ++--
 src/doveadm/dsync/dsync-brain-mails.c           |   2 +-
 src/doveadm/dsync/dsync-slave-pipe.c            |   4 +-
 src/doveadm/dsync/dsync-slave.c                 |   4 ++-
 src/doveadm/dsync/dsync-slave.h                 |  17 +++++++------
 src/doveadm/dsync/dsync-transaction-log-scan.c  |  14 +++++-----
 src/imap-login/client.c                         |   2 +-
 src/imap/cmd-append.c                           |   2 +-
 src/imap/imap-client.c                          |   4 +-
 src/imap/imap-common.h                          |   2 +-
 src/imap/imap-search.c                          |   2 +-
 src/imap/imap-sync.c                            |   2 +-
 src/imap/imap-sync.h                            |   2 +-
 src/lib-dict/dict-client.c                      |  10 ++++----
 src/lib-dict/dict-file.c                        |   2 +-
 src/lib-imap-client/imapc-connection.c          |   8 +++---
 src/lib-imap/imap-bodystructure.c               |   4 +-
 src/lib-index/mail-index-strmap.c               |   2 +-
 src/lib-index/mail-index-transaction.c          |   4 +-
 src/lib-index/mail-index.h                      |   3 +-
 src/lib-index/mail-transaction-log-file.c       |   2 +-
 src/lib-mail/istream-binary-converter.c         |   4 +-
 src/lib-mail/message-decoder.c                  |   2 +-
 src/lib-mail/message-parser.c                   |   2 +-
 src/lib-mail/rfc2231-parser.h                   |   5 ++-
 src/lib-storage/index/dbox-multi/mdbox-mail.c   |   2 +-
 src/lib-storage/index/dbox-single/sdbox-mail.c  |   2 +-
 src/lib-storage/index/dbox-single/sdbox-sync.c  |   2 +-
 src/lib-storage/index/index-storage.c           |   8 ++----
 src/lib-storage/index/index-thread.c            |   6 ++--
 src/lib-storage/index/index-transaction.c       |   2 +-
 src/lib-storage/index/maildir/maildir-mail.c    |   2 +-
 src/lib-storage/index/maildir/maildir-sync.c    |   4 +-
 src/lib-storage/index/maildir/maildir-uidlist.c |   2 +-
 src/lib-storage/index/mbox/mbox-lock.c          |  31 +++++++++++++-----------
 src/lib-storage/index/mbox/mbox-lock.h          |   3 +-
 src/lib-storage/index/mbox/mbox-mail.c          |   2 +-
 src/lib-storage/index/mbox/mbox-save.c          |   2 +-
 src/lib-storage/index/mbox/mbox-storage.c       |   4 +-
 src/lib-storage/index/mbox/mbox-sync.c          |   6 ++--
 src/lib-storage/index/pop3c/pop3c-client.c      |   8 +++---
 src/lib-storage/list/subscription-file.c        |   2 +-
 src/lib-storage/mail-storage.c                  |   2 +-
 src/lib-storage/mail-storage.h                  |  10 ++++---
 src/lib-storage/mailbox-list.h                  |   5 ++-
 src/lib-test/test-common.c                      |   2 +-
 src/lib/bsearch-insert-pos.h                    |  10 ++++---
 src/lib/file-dotlock.c                          |   7 +----
 src/lib/file-dotlock.h                          |   5 +--
 src/lib/iostream-rawlog.h                       |   5 ++-
 src/lib/istream-base64-encoder.c                |   2 +-
 src/lib/istream-data.c                          |   2 +-
 src/lib/istream-private.h                       |   7 +++--
 src/lib/istream.c                               |   2 +-
 src/lib/network.h                               |   2 +-
 src/login-common/client-common-auth.c           |   2 +-
 src/login-common/client-common.h                |   2 +-
 src/login-common/login-proxy.c                  |   2 +-
 src/login-common/ssl-proxy-gnutls.c             |   4 +-
 src/login-common/ssl-proxy-openssl.c            |  12 ++++----
 src/plugins/fts-lucene/fts-backend-lucene.c     |   4 +-
 src/plugins/fts-solr/fts-backend-solr-old.c     |   4 +-
 src/plugins/fts-solr/fts-backend-solr.c         |   4 +-
 src/plugins/fts/fts-api-private.h               |   3 +-
 src/plugins/fts/fts-api.c                       |   2 +-
 src/plugins/fts/fts-parser-script.c             |   2 +-
 src/plugins/fts/fts-storage.c                   |   5 +--
 src/plugins/imap-acl/imap-acl-plugin.c          |   2 +-
 src/plugins/imap-quota/imap-quota-plugin.c      |   2 +-
 src/plugins/imap-zlib/imap-zlib-plugin.c        |   2 +-
 src/pop3/pop3-client.c                          |   7 +----
 77 files changed, 173 insertions(+), 169 deletions(-)

diffs (truncated from 1443 to 300 lines):

diff -r 7c058aa05b0a -r 128c598d2870 src/auth/auth-worker-server.h
--- a/src/auth/auth-worker-server.h	Mon Jun 25 02:52:33 2012 +0300
+++ b/src/auth/auth-worker-server.h	Mon Jun 25 03:21:25 2012 +0300
@@ -6,7 +6,7 @@
 
 typedef bool auth_worker_callback_t(const char *reply, void *context);
 
-struct auth_worker_connection *
+struct auth_worker_connection * ATTR_NOWARN_UNUSED_RESULT
 auth_worker_call(pool_t pool, struct auth_stream_reply *data,
 		 auth_worker_callback_t *callback, void *context);
 void auth_worker_server_resume_input(struct auth_worker_connection *conn);
diff -r 7c058aa05b0a -r 128c598d2870 src/auth/passdb-blocking.c
--- a/src/auth/passdb-blocking.c	Mon Jun 25 02:52:33 2012 +0300
+++ b/src/auth/passdb-blocking.c	Mon Jun 25 03:21:25 2012 +0300
@@ -88,8 +88,7 @@
 	auth_request_export(request, reply);
 
 	auth_request_ref(request);
-	(void)auth_worker_call(request->pool, reply,
-			       verify_plain_callback, request);
+	auth_worker_call(request->pool, reply, verify_plain_callback, request);
 }
 
 static bool lookup_credentials_callback(const char *reply, void *context)
@@ -131,8 +130,8 @@
 	auth_request_export(request, reply);
 
 	auth_request_ref(request);
-	(void)auth_worker_call(request->pool, reply,
-			       lookup_credentials_callback, request);
+	auth_worker_call(request->pool, reply,
+			 lookup_credentials_callback, request);
 }
 
 static bool
@@ -159,6 +158,6 @@
 	auth_request_export(request, reply);
 
 	auth_request_ref(request);
-	(void)auth_worker_call(request->pool, reply,
-			       set_credentials_callback, request);
+	auth_worker_call(request->pool, reply,
+			 set_credentials_callback, request);
 }
diff -r 7c058aa05b0a -r 128c598d2870 src/auth/userdb-blocking.c
--- a/src/auth/userdb-blocking.c	Mon Jun 25 02:52:33 2012 +0300
+++ b/src/auth/userdb-blocking.c	Mon Jun 25 03:21:25 2012 +0300
@@ -58,7 +58,7 @@
 	auth_request_export(request, reply);
 
 	auth_request_ref(request);
-	(void)auth_worker_call(request->pool, reply, user_callback, request);
+	auth_worker_call(request->pool, reply, user_callback, request);
 }
 
 static bool iter_callback(const char *reply, void *context)
diff -r 7c058aa05b0a -r 128c598d2870 src/doveadm/doveadm-mail-expunge.c
--- a/src/doveadm/doveadm-mail-expunge.c	Mon Jun 25 02:52:33 2012 +0300
+++ b/src/doveadm/doveadm-mail-expunge.c	Mon Jun 25 03:21:25 2012 +0300
@@ -48,7 +48,7 @@
 
 	if (ctx->delete_empty_mailbox && ret == 0) {
 		if (mailbox_delete_empty(box) < 0) {
-			(void)mailbox_get_last_error(box, &error);
+			error = mailbox_get_last_mail_error(box);
 			if (error != MAIL_ERROR_EXISTS) {
 				doveadm_mail_failed_mailbox(_ctx, box);
 				ret = -1;
diff -r 7c058aa05b0a -r 128c598d2870 src/doveadm/doveadm-mail.c
--- a/src/doveadm/doveadm-mail.c	Mon Jun 25 02:52:33 2012 +0300
+++ b/src/doveadm/doveadm-mail.c	Mon Jun 25 03:21:25 2012 +0300
@@ -76,7 +76,7 @@
 {
 	enum mail_error error;
 
-	(void)mail_storage_get_last_error(storage, &error);
+	mail_storage_get_last_error(storage, &error);
 	doveadm_mail_failed_error(ctx, error);
 }
 
diff -r 7c058aa05b0a -r 128c598d2870 src/doveadm/dsync/dsync-brain-mailbox-tree.c
--- a/src/doveadm/dsync/dsync-brain-mailbox-tree.c	Mon Jun 25 02:52:33 2012 +0300
+++ b/src/doveadm/dsync/dsync-brain-mailbox-tree.c	Mon Jun 25 03:21:25 2012 +0300
@@ -122,8 +122,8 @@
 
 	deletes = dsync_mailbox_tree_get_deletes(brain->local_mailbox_tree,
 						 &count);
-	(void)dsync_slave_send_mailbox_deletes(brain->slave, deletes, count,
-					       brain->hierarchy_sep);
+	dsync_slave_send_mailbox_deletes(brain->slave, deletes, count,
+					 brain->hierarchy_sep);
 
 	brain->state = DSYNC_STATE_RECV_MAILBOX_TREE;
 }
diff -r 7c058aa05b0a -r 128c598d2870 src/doveadm/dsync/dsync-brain-mailbox.c
--- a/src/doveadm/dsync/dsync-brain-mailbox.c	Mon Jun 25 02:52:33 2012 +0300
+++ b/src/doveadm/dsync/dsync-brain-mailbox.c	Mon Jun 25 03:21:25 2012 +0300
@@ -372,7 +372,7 @@
 	}
 
 	/* start exporting this mailbox (wait for remote to start importing) */
-	(void)dsync_slave_send_mailbox(brain->slave, &dsync_box);
+	dsync_slave_send_mailbox(brain->slave, &dsync_box);
 	(void)dsync_brain_sync_mailbox_init(brain, box, &dsync_box,
 					    DSYNC_BOX_STATE_MAILBOX);
 	brain->state = DSYNC_STATE_SYNC_MAILS;
@@ -560,13 +560,13 @@
 		memcpy(delete_box.mailbox_guid, dsync_box->mailbox_guid,
 		       sizeof(delete_box.mailbox_guid));
 		delete_box.mailbox_lost = TRUE;
-		(void)dsync_slave_send_mailbox(brain->slave, &delete_box);
+		dsync_slave_send_mailbox(brain->slave, &delete_box);
 		return TRUE;
 	}
 	i_assert(local_dsync_box.uid_validity != 0);
 	i_assert(memcmp(dsync_box->mailbox_guid, local_dsync_box.mailbox_guid,
 			sizeof(dsync_box->mailbox_guid)) == 0);
-	(void)dsync_slave_send_mailbox(brain->slave, &local_dsync_box);
+	dsync_slave_send_mailbox(brain->slave, &local_dsync_box);
 
 	dsync_brain_mailbox_update_pre(brain, box, &local_dsync_box, dsync_box);
 
diff -r 7c058aa05b0a -r 128c598d2870 src/doveadm/dsync/dsync-brain-mails.c
--- a/src/doveadm/dsync/dsync-brain-mails.c	Mon Jun 25 02:52:33 2012 +0300
+++ b/src/doveadm/dsync/dsync-brain-mails.c	Mon Jun 25 03:21:25 2012 +0300
@@ -155,7 +155,7 @@
 		if (changes_during_sync)
 			brain->changes_during_sync = TRUE;
 	}
-	(void)dsync_slave_send_mailbox_state(brain->slave, &state);
+	dsync_slave_send_mailbox_state(brain->slave, &state);
 }
 
 static bool dsync_brain_recv_mail(struct dsync_brain *brain)
diff -r 7c058aa05b0a -r 128c598d2870 src/doveadm/dsync/dsync-slave-pipe.c
--- a/src/doveadm/dsync/dsync-slave-pipe.c	Mon Jun 25 02:52:33 2012 +0300
+++ b/src/doveadm/dsync/dsync-slave-pipe.c	Mon Jun 25 03:21:25 2012 +0300
@@ -68,7 +68,7 @@
 	return ret;
 }
 
-static struct item *
+static struct item * ATTR_NOWARN_UNUSED_RESULT
 dsync_slave_pipe_push_item(struct dsync_slave_pipe *pipe, enum item_type type)
 {
 	struct item *item;
@@ -193,7 +193,7 @@
 {
 	struct dsync_slave_pipe *pipe = (struct dsync_slave_pipe *)slave;
 
-	(void)dsync_slave_pipe_push_item(pipe->remote, ITEM_END_OF_LIST);
+	dsync_slave_pipe_push_item(pipe->remote, ITEM_END_OF_LIST);
 }
 
 static void
diff -r 7c058aa05b0a -r 128c598d2870 src/doveadm/dsync/dsync-slave.c
--- a/src/doveadm/dsync/dsync-slave.c	Mon Jun 25 02:52:33 2012 +0300
+++ b/src/doveadm/dsync/dsync-slave.c	Mon Jun 25 03:21:25 2012 +0300
@@ -40,9 +40,11 @@
 		DSYNC_SLAVE_SEND_RET_OK;
 }
 
-void dsync_slave_send_end_of_list(struct dsync_slave *slave)
+enum dsync_slave_send_ret
+dsync_slave_send_end_of_list(struct dsync_slave *slave)
 {
 	slave->v.send_end_of_list(slave);
+	return dsync_slave_send_ret(slave);
 }
 
 enum dsync_slave_send_ret
diff -r 7c058aa05b0a -r 128c598d2870 src/doveadm/dsync/dsync-slave.h
--- a/src/doveadm/dsync/dsync-slave.h	Mon Jun 25 02:52:33 2012 +0300
+++ b/src/doveadm/dsync/dsync-slave.h	Mon Jun 25 03:21:25 2012 +0300
@@ -54,16 +54,17 @@
 dsync_slave_recv_handshake(struct dsync_slave *slave,
 			   const struct dsync_slave_settings **set_r);
 
-void dsync_slave_send_end_of_list(struct dsync_slave *slave);
+enum dsync_slave_send_ret ATTR_NOWARN_UNUSED_RESULT
+dsync_slave_send_end_of_list(struct dsync_slave *slave);
 
-enum dsync_slave_send_ret
+enum dsync_slave_send_ret ATTR_NOWARN_UNUSED_RESULT
 dsync_slave_send_mailbox_state(struct dsync_slave *slave,
 			       const struct dsync_mailbox_state *state);
 enum dsync_slave_recv_ret
 dsync_slave_recv_mailbox_state(struct dsync_slave *slave,
 			       struct dsync_mailbox_state *state_r);
 
-enum dsync_slave_send_ret
+enum dsync_slave_send_ret ATTR_NOWARN_UNUSED_RESULT
 dsync_slave_send_mailbox_tree_node(struct dsync_slave *slave,
 				   const char *const *name,
 				   const struct dsync_mailbox_node *node);
@@ -72,7 +73,7 @@
 				   const char *const **name_r,
 				   const struct dsync_mailbox_node **node_r);
 
-enum dsync_slave_send_ret
+enum dsync_slave_send_ret ATTR_NOWARN_UNUSED_RESULT
 dsync_slave_send_mailbox_deletes(struct dsync_slave *slave,
 				 const struct dsync_mailbox_delete *deletes,
 				 unsigned int count, char hierarchy_sep);
@@ -81,28 +82,28 @@
 				 const struct dsync_mailbox_delete **deletes_r,
 				 unsigned int *count_r, char *hierarchy_sep_r);
 
-enum dsync_slave_send_ret
+enum dsync_slave_send_ret ATTR_NOWARN_UNUSED_RESULT
 dsync_slave_send_mailbox(struct dsync_slave *slave,
 			 const struct dsync_mailbox *dsync_box);
 enum dsync_slave_recv_ret
 dsync_slave_recv_mailbox(struct dsync_slave *slave,
 			 const struct dsync_mailbox **dsync_box_r);
 
-enum dsync_slave_send_ret
+enum dsync_slave_send_ret ATTR_NOWARN_UNUSED_RESULT
 dsync_slave_send_change(struct dsync_slave *slave,
 			const struct dsync_mail_change *change);
 enum dsync_slave_recv_ret
 dsync_slave_recv_change(struct dsync_slave *slave,
 			const struct dsync_mail_change **change_r);
 
-enum dsync_slave_send_ret
+enum dsync_slave_send_ret ATTR_NOWARN_UNUSED_RESULT
 dsync_slave_send_mail_request(struct dsync_slave *slave,
 			      const struct dsync_mail_request *request);
 enum dsync_slave_recv_ret
 dsync_slave_recv_mail_request(struct dsync_slave *slave,
 			      const struct dsync_mail_request **request_r);
 
-enum dsync_slave_send_ret
+enum dsync_slave_send_ret ATTR_NOWARN_UNUSED_RESULT
 dsync_slave_send_mail(struct dsync_slave *slave,
 		      const struct dsync_mail *mail);
 enum dsync_slave_recv_ret
diff -r 7c058aa05b0a -r 128c598d2870 src/doveadm/dsync/dsync-transaction-log-scan.c
--- a/src/doveadm/dsync/dsync-transaction-log-scan.c	Mon Jun 25 02:52:33 2012 +0300
+++ b/src/doveadm/dsync/dsync-transaction-log-scan.c	Mon Jun 25 03:21:25 2012 +0300
@@ -19,7 +19,7 @@
 	bool returned_all_changes;
 };
 
-static bool
+static bool ATTR_NOWARN_UNUSED_RESULT
 export_change_get(struct dsync_transaction_log_scan *ctx, uint32_t uid,
 		  enum dsync_mail_change_type type,
 		  struct dsync_mail_change **change_r)
@@ -74,9 +74,9 @@
 	end = CONST_PTR_OFFSET(data, hdr->size);
 	for (; rec != end; rec++) {
 		for (uid = rec->uid1; uid <= rec->uid2; uid++) {
-			(void)export_change_get(ctx, uid,
-						DSYNC_MAIL_CHANGE_TYPE_EXPUNGE,
-						&change);
+			export_change_get(ctx, uid,
+					  DSYNC_MAIL_CHANGE_TYPE_EXPUNGE,
+					  &change);
 		}
 	}
 }
@@ -95,9 +95,9 @@
 	end = CONST_PTR_OFFSET(data, hdr->size);
 	for (; rec != end; rec++) {
 		if (uid >= rec->uid1 && uid <= rec->uid2) {
-			(void)export_change_get(ctx, uid,
-						DSYNC_MAIL_CHANGE_TYPE_EXPUNGE,
-						&change);
+			export_change_get(ctx, uid,
+					  DSYNC_MAIL_CHANGE_TYPE_EXPUNGE,
+					  &change);
 			return TRUE;
 		}
 	}
diff -r 7c058aa05b0a -r 128c598d2870 src/imap-login/client.c
--- a/src/imap-login/client.c	Mon Jun 25 02:52:33 2012 +0300
+++ b/src/imap-login/client.c	Mon Jun 25 03:21:25 2012 +0300
@@ -371,7 +371,7 @@
 		}
 	}
 	o_stream_uncork(imap_client->common.output);
-	(void)client_unref(&client);
+	client_unref(&client);
 }
 
 static struct client *imap_client_alloc(pool_t pool)
diff -r 7c058aa05b0a -r 128c598d2870 src/imap/cmd-append.c
--- a/src/imap/cmd-append.c	Mon Jun 25 02:52:33 2012 +0300
+++ b/src/imap/cmd-append.c	Mon Jun 25 03:21:25 2012 +0300
@@ -114,7 +114,7 @@
 		(void)client_handle_unfinished_cmd(cmd);
 	else
 		client_command_free(&cmd);
-	(void)cmd_sync_delayed(client);
+	cmd_sync_delayed(client);
 	o_stream_uncork(client->output);
 
 	if (client->disconnected)


More information about the dovecot-cvs mailing list