dovecot-2.2: Added array_append_zero() to write a zero-filled re...

dovecot at dovecot.org dovecot at dovecot.org
Mon Jun 25 02:38:46 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/9ff19c1d5f69
changeset: 14686:9ff19c1d5f69
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Jun 25 02:38:29 2012 +0300
description:
Added array_append_zero() to write a zero-filled record to an array.
Replaced (void)array_append_space() calls with it.

diffstat:

 src/auth/auth-settings.c                            |  2 +-
 src/auth/db-ldap.c                                  |  2 +-
 src/config/config-filter.c                          |  6 +++---
 src/config/config-parser.c                          |  4 ++--
 src/doveadm/doveadm-mail-fetch.c                    |  2 +-
 src/doveadm/doveadm-mailbox-list-iter.c             |  2 +-
 src/doveadm/dsync/doveadm-dsync.c                   |  4 ++--
 src/doveadm/dsync/dsync-brain-mailbox.c             |  4 ++--
 src/doveadm/dsync/dsync-mailbox-import.c            |  6 +++---
 src/imap/cmd-list.c                                 |  4 ++--
 src/imap/imap-commands-util.c                       |  4 ++--
 src/imap/imap-fetch.c                               |  2 +-
 src/lib-auth/auth-master.c                          |  2 +-
 src/lib-imap-storage/imap-msgpart.c                 |  2 +-
 src/lib-imap/imap-match.c                           |  2 +-
 src/lib-index/mail-cache-compress.c                 |  2 +-
 src/lib-index/mail-index-strmap.c                   |  6 +++---
 src/lib-index/mail-index.c                          |  2 +-
 src/lib-mail/rfc2231-parser.c                       |  4 ++--
 src/lib-master/master-service-settings.c            |  2 +-
 src/lib-sql/driver-sqlpool.c                        |  2 +-
 src/lib-storage/fail-mail.c                         |  2 +-
 src/lib-storage/index/dbox-common/dbox-attachment.c |  2 +-
 src/lib-storage/index/imapc/imapc-mailbox.c         |  2 +-
 src/lib-storage/index/index-mail-headers.c          |  4 ++--
 src/lib-storage/index/index-mail.c                  |  4 ++--
 src/lib-storage/index/index-search.c                |  2 +-
 src/lib-storage/index/pop3c/pop3c-sync.c            |  2 +-
 src/lib-storage/list/mailbox-list-fs-iter.c         |  2 +-
 src/lib-storage/mailbox-keywords.c                  |  2 +-
 src/lib/array.h                                     |  2 ++
 src/lib/ioloop-epoll.c                              |  2 +-
 src/lib/ioloop-kqueue.c                             |  2 +-
 src/lib/uri-util.c                                  |  2 +-
 src/lib/var-expand.c                                |  2 +-
 src/master/main.c                                   |  2 +-
 src/plugins/acl/doveadm-acl.c                       |  4 ++--
 src/plugins/expire/doveadm-expire.c                 |  2 +-
 src/plugins/expire/expire-plugin.c                  |  2 +-
 src/plugins/fts-lucene/fts-backend-lucene.c         |  2 +-
 src/plugins/fts-solr/fts-backend-solr-old.c         |  2 +-
 src/plugins/fts-solr/fts-backend-solr.c             |  2 +-
 src/plugins/fts-solr/solr-connection.c              |  2 +-
 src/plugins/fts/fts-search.c                        |  2 +-
 src/plugins/imap-acl/imap-acl-plugin.c              |  4 ++--
 src/plugins/virtual/virtual-save.c                  |  2 +-
 src/util/script.c                                   |  2 +-
 47 files changed, 64 insertions(+), 62 deletions(-)

diffs (truncated from 701 to 300 lines):

diff -r 67b9119fbd09 -r 9ff19c1d5f69 src/auth/auth-settings.c
--- a/src/auth/auth-settings.c	Mon Jun 25 02:22:12 2012 +0300
+++ b/src/auth/auth-settings.c	Mon Jun 25 02:38:29 2012 +0300
@@ -299,7 +299,7 @@
 		}
 		array_append(&ips_array, ips, ips_count);
 	}
-	(void)array_append_space(&ips_array);
+	array_append_zero(&ips_array);
 	set->proxy_self_ips = array_idx(&ips_array, 0);
 	return TRUE;
 }
diff -r 67b9119fbd09 -r 9ff19c1d5f69 src/auth/db-ldap.c
--- a/src/auth/db-ldap.c	Mon Jun 25 02:22:12 2012 +0300
+++ b/src/auth/db-ldap.c	Mon Jun 25 02:38:29 2012 +0300
@@ -1063,7 +1063,7 @@
 				array_append(&ctx.attr_names, &ldap_attr, 1);
 		}
 	}
-	(void)array_append_space(&ctx.attr_names);
+	array_append_zero(&ctx.attr_names);
 	*attr_names_r = array_idx_modifiable(&ctx.attr_names, 0);
 }
 
diff -r 67b9119fbd09 -r 9ff19c1d5f69 src/config/config-filter.c
--- a/src/config/config-filter.c	Mon Jun 25 02:22:12 2012 +0300
+++ b/src/config/config-filter.c	Mon Jun 25 02:38:29 2012 +0300
@@ -221,12 +221,12 @@
 		}
 	}
 	if (filter->service == NULL) {
-		(void)array_append_space(&service_names);
+		array_append_zero(&service_names);
 		output_r->specific_services = array_idx(&service_names, 0);
 	}
 
 	array_sort(&matches, config_filter_parser_cmp);
-	(void)array_append_space(&matches);
+	array_append_zero(&matches);
 	return array_idx(&matches, 0);
 }
 
@@ -259,7 +259,7 @@
 			array_append(&matches, &ctx->parsers[i], 1);
 	}
 	array_sort(&matches, config_filter_parser_cmp_rev);
-	(void)array_append_space(&matches);
+	array_append_zero(&matches);
 	return array_idx(&matches, 0);
 }
 
diff -r 67b9119fbd09 -r 9ff19c1d5f69 src/config/config-parser.c
--- a/src/config/config-parser.c	Mon Jun 25 02:22:12 2012 +0300
+++ b/src/config/config-parser.c	Mon Jun 25 02:38:29 2012 +0300
@@ -681,7 +681,7 @@
 	int ret;
 
 	new_filter = config_filter_init(ctx->pool);
-	(void)array_append_space(&ctx->all_parsers);
+	array_append_zero(&ctx->all_parsers);
 	config_filter_add_all(new_filter, array_idx(&ctx->all_parsers, 0));
 
 	if (ctx->hide_errors)
@@ -1007,7 +1007,7 @@
 		   using the new list. */
 		for (i = 0; all_roots[i] != NULL; i++)
 			array_append(&new_roots, &all_roots[i], 1);
-		(void)array_append_space(&new_roots);
+		array_append_zero(&new_roots);
 		all_roots = array_idx(&new_roots, 0);
 	}
 	if (array_count(&new_services) > 0) {
diff -r 67b9119fbd09 -r 9ff19c1d5f69 src/doveadm/doveadm-mail-fetch.c
--- a/src/doveadm/doveadm-mail-fetch.c	Mon Jun 25 02:22:12 2012 +0300
+++ b/src/doveadm/doveadm-mail-fetch.c	Mon Jun 25 02:38:29 2012 +0300
@@ -474,7 +474,7 @@
 			array_append(&ctx->fields, field, 1);
 		}
 	}
-	(void)array_append_space(&ctx->header_fields);
+	array_append_zero(&ctx->header_fields);
 }
 
 static int cmd_fetch_mail(struct fetch_cmd_context *ctx)
diff -r 67b9119fbd09 -r 9ff19c1d5f69 src/doveadm/doveadm-mailbox-list-iter.c
--- a/src/doveadm/doveadm-mailbox-list-iter.c	Mon Jun 25 02:22:12 2012 +0300
+++ b/src/doveadm/doveadm-mailbox-list-iter.c	Mon Jun 25 02:38:29 2012 +0300
@@ -100,7 +100,7 @@
 		   without lookup ACL right */
 		return iter;
 	}
-	(void)array_append_space(&iter->patterns);
+	array_append_zero(&iter->patterns);
 
 	iter->only_selectable = TRUE;
 	iter->iter_flags = iter_flags;
diff -r 67b9119fbd09 -r 9ff19c1d5f69 src/doveadm/dsync/doveadm-dsync.c
--- a/src/doveadm/dsync/doveadm-dsync.c	Mon Jun 25 02:22:12 2012 +0300
+++ b/src/doveadm/dsync/doveadm-dsync.c	Mon Jun 25 02:38:29 2012 +0300
@@ -125,7 +125,7 @@
 		p = "dsync-server";
 	}
 	array_append(&cmd_args, &p, 1);
-	(void)array_append_space(&cmd_args);
+	array_append_zero(&cmd_args);
 	*cmd_args_r = array_idx(&cmd_args, 0);
 }
 
@@ -177,7 +177,7 @@
 		}
 		array_append(&cmd_args, &value, 1);
 	}
-	(void)array_append_space(&cmd_args);
+	array_append_zero(&cmd_args);
 	return array_idx(&cmd_args, 0);
 }
 
diff -r 67b9119fbd09 -r 9ff19c1d5f69 src/doveadm/dsync/dsync-brain-mailbox.c
--- a/src/doveadm/dsync/dsync-brain-mailbox.c	Mon Jun 25 02:22:12 2012 +0300
+++ b/src/doveadm/dsync/dsync-brain-mailbox.c	Mon Jun 25 02:38:29 2012 +0300
@@ -420,7 +420,7 @@
 
 	if (array_count(&local_sorted) == 0) {
 		/* local has no cached fields. set them to same as remote. */
-		(void)array_append_space(&remote_sorted);
+		array_append_zero(&remote_sorted);
 		update->cache_updates = array_idx(&remote_sorted, 0);
 		return;
 	}
@@ -464,7 +464,7 @@
 	}
 	i_assert(li == local_count && ri == remote_count);
 	if (array_count(&changes) > 0) {
-		(void)array_append_space(&changes);
+		array_append_zero(&changes);
 		update->cache_updates = array_idx(&changes, 0);
 	}
 }
diff -r 67b9119fbd09 -r 9ff19c1d5f69 src/doveadm/dsync/dsync-mailbox-import.c
--- a/src/doveadm/dsync/dsync-mailbox-import.c	Mon Jun 25 02:22:12 2012 +0300
+++ b/src/doveadm/dsync/dsync-mailbox-import.c	Mon Jun 25 02:38:29 2012 +0300
@@ -619,14 +619,14 @@
 
 	/* apply changes */
 	if (array_count(&add_keywords) > 0) {
-		(void)array_append_space(&add_keywords);
+		array_append_zero(&add_keywords);
 		kw = mailbox_keywords_create_valid(mail->box,
 			array_idx(&add_keywords, 0));
 		mail_update_keywords(mail, MODIFY_ADD, kw);
 		mailbox_keywords_unref(&kw);
 	}
 	if (array_count(&remove_keywords) > 0) {
-		(void)array_append_space(&remove_keywords);
+		array_append_zero(&remove_keywords);
 		kw = mailbox_keywords_create_valid(mail->box,
 			array_idx(&remove_keywords, 0));
 		mail_update_keywords(mail, MODIFY_REMOVE, kw);
@@ -1068,7 +1068,7 @@
 	if (array_count(&keywords) == 0)
 		return NULL;
 
-	(void)array_append_space(&keywords);
+	array_append_zero(&keywords);
 	return array_idx(&keywords, 0);
 }
 
diff -r 67b9119fbd09 -r 9ff19c1d5f69 src/imap/cmd-list.c
--- a/src/imap/cmd-list.c	Mon Jun 25 02:22:12 2012 +0300
+++ b/src/imap/cmd-list.c	Mon Jun 25 02:38:29 2012 +0300
@@ -786,7 +786,7 @@
 		pattern = "INBOX";
 		array_append(&used_patterns, &pattern, 1);
 	}
-	(void)array_append_space(&used_patterns); /* NULL-terminate */
+	array_append_zero(&used_patterns); /* NULL-terminate */
 	pat = array_idx(&used_patterns, 0);
 
 	ctx->list_iter = mailbox_list_iter_init_multiple(ns->list, pat,
@@ -996,7 +996,7 @@
 		return TRUE;
 	}
 
-	(void)array_append_space(&patterns); /* NULL-terminate */
+	array_append_zero(&patterns); /* NULL-terminate */
 	patterns_strarr = array_idx(&patterns, 0);
 	if (!ctx->used_listext && !lsub && *patterns_strarr[0] == '\0') {
 		/* Only LIST ref "" gets us here */
diff -r 67b9119fbd09 -r 9ff19c1d5f69 src/imap/imap-commands-util.c
--- a/src/imap/imap-commands-util.c	Mon Jun 25 02:22:12 2012 +0300
+++ b/src/imap/imap-commands-util.c	Mon Jun 25 02:38:29 2012 +0300
@@ -232,7 +232,7 @@
 	if (array_count(&keywords) == 0)
 		*keywords_r = NULL;
 	else {
-		(void)array_append_space(&keywords); /* NULL-terminate */
+		array_append_zero(&keywords); /* NULL-terminate */
 		*keywords_r = array_idx(&keywords, 0);
 	}
 	return TRUE;
@@ -309,7 +309,7 @@
 		array_append(dest, &all_names[kw_index], 1);
 	}
 
-	(void)array_append_space(dest);
+	array_append_zero(dest);
 	return array_idx(dest, 0);
 }
 
diff -r 67b9119fbd09 -r 9ff19c1d5f69 src/imap/imap-fetch.c
--- a/src/imap/imap-fetch.c	Mon Jun 25 02:22:12 2012 +0300
+++ b/src/imap/imap-fetch.c	Mon Jun 25 02:38:29 2012 +0300
@@ -348,7 +348,7 @@
 	if (array_count(&ctx->all_headers) > 0 &&
 	    ((ctx->fetch_data & (MAIL_FETCH_STREAM_HEADER |
 				 MAIL_FETCH_STREAM_BODY)) == 0)) {
-		(void)array_append_space(&ctx->all_headers);
+		array_append_zero(&ctx->all_headers);
 
 		data = array_idx(&ctx->all_headers, 0);
 		ctx->all_headers_ctx =
diff -r 67b9119fbd09 -r 9ff19c1d5f69 src/lib-auth/auth-master.c
--- a/src/lib-auth/auth-master.c	Mon Jun 25 02:22:12 2012 +0300
+++ b/src/lib-auth/auth-master.c	Mon Jun 25 02:38:29 2012 +0300
@@ -186,7 +186,7 @@
 			array_append(&new_args, &args[i], 1);
 		}
 	}
-	(void)array_append_space(&new_args);
+	array_append_zero(&new_args);
 	return array_idx(&new_args, 0);
 }
 
diff -r 67b9119fbd09 -r 9ff19c1d5f69 src/lib-imap-storage/imap-msgpart.c
--- a/src/lib-imap-storage/imap-msgpart.c	Mon Jun 25 02:22:12 2012 +0300
+++ b/src/lib-imap-storage/imap-msgpart.c	Mon Jun 25 02:38:29 2012 +0300
@@ -175,7 +175,7 @@
 					   &fields) < 0)
 		return -1;
 
-	(void)array_append_space(&fields);
+	array_append_zero(&fields);
 	msgpart->headers = array_idx(&fields, 0);
 	msgpart->header_ctx = mailbox_header_lookup_init(box, msgpart->headers);
 	return 0;
diff -r 67b9119fbd09 -r 9ff19c1d5f69 src/lib-imap/imap-match.c
--- a/src/lib-imap/imap-match.c	Mon Jun 25 02:22:12 2012 +0300
+++ b/src/lib-imap/imap-match.c	Mon Jun 25 02:38:29 2012 +0300
@@ -189,7 +189,7 @@
 			inboxcase = TRUE;
 		array_append(&patterns, &p->pattern, 1);
 	}
-	(void)array_append_space(&patterns);
+	array_append_zero(&patterns);
 	return imap_match_init_multiple_real(pool, array_idx(&patterns, 0),
 					     inboxcase, glob->sep);
 }
diff -r 67b9119fbd09 -r 9ff19c1d5f69 src/lib-index/mail-cache-compress.c
--- a/src/lib-index/mail-cache-compress.c	Mon Jun 25 02:22:12 2012 +0300
+++ b/src/lib-index/mail-cache-compress.c	Mon Jun 25 02:38:29 2012 +0300
@@ -234,7 +234,7 @@
 	i_array_init(ext_offsets, message_count);
 	for (seq = 1; seq <= message_count; seq++) {
 		if (mail_index_transaction_is_expunged(trans, seq)) {
-			(void)array_append_space(ext_offsets);
+			array_append_zero(ext_offsets);
 			continue;
 		}
 
diff -r 67b9119fbd09 -r 9ff19c1d5f69 src/lib-index/mail-index-strmap.c
--- a/src/lib-index/mail-index-strmap.c	Mon Jun 25 02:22:12 2012 +0300
+++ b/src/lib-index/mail-index-strmap.c	Mon Jun 25 02:38:29 2012 +0300
@@ -803,7 +803,7 @@
 	rec.ref_index = ref_index;
 	rec.str_idx = view->next_str_idx++;
 	array_append(&view->recs, &rec, 1);
-	(void)array_append_space(&view->recs_crc32);
+	array_append_zero(&view->recs_crc32);
 
 	view->last_added_uid = uid;
 	view->last_ref_index = ref_index;
@@ -813,7 +813,7 @@
 mail_index_strmap_zero_terminate(struct mail_index_strmap_view *view)
 {
 	/* zero-terminate the records array */
-	(void)array_append_space(&view->recs);
+	array_append_zero(&view->recs);
 	array_delete(&view->recs, array_count(&view->recs)-1, 1);
 }
 
@@ -1238,7 +1238,7 @@
 	mail_index_strmap_zero_terminate(view);
 
 	/* zero-terminate the records array */
-	(void)array_append_space(&view->recs);
+	array_append_zero(&view->recs);
 	array_delete(&view->recs, array_count(&view->recs)-1, 1);
 }
 
diff -r 67b9119fbd09 -r 9ff19c1d5f69 src/lib-index/mail-index.c


More information about the dovecot-cvs mailing list