changeset 4596:bf4e98a0de3f HEAD

Replaced ARRAY_CREATE() macro with [ipt]_array_init() macros. The macro has no side effects so it might as well be lowercased.
author Timo Sirainen <tss@iki.fi>
date Sun, 10 Sep 2006 15:48:12 +0300
parents 6964aa1c1898
children fc07c947eed9
files src/auth/auth-master-listener.c src/auth/userdb-static.c src/dict/dict-server.c src/imap/commands-util.c src/imap/imap-fetch.c src/imap/imap-thread.c src/lib-dict/dict.c src/lib-index/mail-cache-transaction.c src/lib-index/mail-cache.c src/lib-index/mail-index-sync-ext.c src/lib-index/mail-index-sync.c src/lib-index/mail-index-transaction.c src/lib-index/mail-index-view-sync.c src/lib-index/mail-index-view.c src/lib-index/mail-index.c src/lib-sql/driver-mysql.c src/lib-sql/sql-api.c src/lib-storage/index/dbox/dbox-keywords.c src/lib-storage/index/dbox/dbox-save.c src/lib-storage/index/dbox/dbox-sync-expunge.c src/lib-storage/index/dbox/dbox-sync-full.c src/lib-storage/index/dbox/dbox-sync.c src/lib-storage/index/dbox/dbox-uidlist.c src/lib-storage/index/index-mail-headers.c src/lib-storage/index/index-mail.c src/lib-storage/index/index-sort.c src/lib-storage/index/maildir/maildir-keywords.c src/lib-storage/index/maildir/maildir-storage.c src/lib-storage/index/maildir/maildir-sync.c src/lib-storage/index/mbox/mbox-sync-parse.c src/lib-storage/index/mbox/mbox-sync-update.c src/lib-storage/index/mbox/mbox-sync.c src/lib-storage/mail-storage.c src/lib/array.h src/lib/ioloop-epoll.c src/lib/ioloop-kqueue.c src/lib/module-dir.c src/lib/seq-range-array.c src/master/mail-process.c src/master/master-settings.c src/plugins/acl/acl-backend-vfile.c src/plugins/acl/acl-cache.c src/plugins/expire/expire-env.c src/plugins/quota/quota-dirsize.c src/plugins/quota/quota.c src/plugins/trash/trash-plugin.c
diffstat 46 files changed, 102 insertions(+), 108 deletions(-) [+]
line wrap: on
line diff
--- a/src/auth/auth-master-listener.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/auth/auth-master-listener.c	Sun Sep 10 15:48:12 2006 +0300
@@ -30,9 +30,9 @@
 	listener = i_new(struct auth_master_listener, 1);
 	listener->auth = auth;
 	listener->pid = (unsigned int)getpid();
-	ARRAY_CREATE(&listener->sockets, default_pool, 16);
-	ARRAY_CREATE(&listener->masters, default_pool, 16);
-	ARRAY_CREATE(&listener->clients, default_pool, 16);
+	i_array_init(&listener->sockets, 16);
+	i_array_init(&listener->masters, 16);
+	i_array_init(&listener->clients, 16);
 	auth_client_connections_init(listener);
 
 	array_append(&master_listeners, &listener, 1);
@@ -165,7 +165,7 @@
 
 void auth_master_listeners_init(void)
 {
-	ARRAY_CREATE(&master_listeners, default_pool, 2);
+	i_array_init(&master_listeners, 2);
 }
 
 void auth_master_listeners_deinit(void)
--- a/src/auth/userdb-static.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/auth/userdb-static.c	Sun Sep 10 15:48:12 2006 +0300
@@ -67,7 +67,7 @@
 	gid = (gid_t)-1;
 
 	tmp = t_strsplit_spaces(args, " ");
-	ARRAY_CREATE(&module->template, auth_userdb->auth->pool,
+	p_array_init(&module->template, auth_userdb->auth->pool,
 		     strarray_length(tmp));
 
 	t_push();
--- a/src/dict/dict-server.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/dict/dict-server.c	Sun Sep 10 15:48:12 2006 +0300
@@ -155,7 +155,7 @@
 	}
 
 	if (!array_is_created(&conn->transactions))
-		ARRAY_CREATE(&conn->transactions, default_pool, 4);
+		i_array_init(&conn->transactions, 4);
 
 	/* <id> */
 	trans = array_append_space(&conn->transactions);
--- a/src/imap/commands-util.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/imap/commands-util.c	Sun Sep 10 15:48:12 2006 +0300
@@ -317,7 +317,7 @@
 		return FALSE;
 
 	p_clear(dest->pool);
-	ARRAY_CREATE(&dest->keywords, dest->pool, array_count(keywords));
+	p_array_init(&dest->keywords, dest->pool, array_count(keywords));
 
 	for (i = 0; i < count; i++) {
 		const char *name = p_strdup(dest->pool, names[i]);
--- a/src/imap/imap-fetch.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/imap/imap-fetch.c	Sun Sep 10 15:48:12 2006 +0300
@@ -95,7 +95,7 @@
 
 	ctx->cur_str = str_new(default_pool, 8192);
 	ctx->all_headers_buf = buffer_create_dynamic(cmd->pool, 128);
-	ARRAY_CREATE(&ctx->handlers, cmd->pool, 16);
+	p_array_init(&ctx->handlers, cmd->pool, 16);
 	ctx->line_finished = TRUE;
 	return ctx;
 }
--- a/src/imap/imap-thread.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/imap/imap-thread.c	Sun Sep 10 15:48:12 2006 +0300
@@ -437,7 +437,7 @@
 	count += APPROX_MSG_EXTRA_COUNT;
 	ctx->msgid_pool =
 		pool_alloconly_create("msgids", count * APPROX_MSGID_SIZE);
-	ARRAY_CREATE(&ctx->msgid_map, default_pool,
+	i_array_init(&ctx->msgid_map,
 		     I_MAX(hdr->record_count, client->messages_count));
 
 	ctx->tmp_mail = mail_alloc(ctx->t, 0, NULL);
@@ -1516,7 +1516,7 @@
 	struct mail_thread_root_rec **roots;
 	unsigned int i, count;
 
-	ARRAY_CREATE(&ctx->moved_recs, default_pool, 128);
+	i_array_init(&ctx->moved_recs, 128);
 	(void)array_append_space(&ctx->moved_recs);
 
 	roots = array_get_modifiable(&ctx->roots, &count);
@@ -1753,7 +1753,7 @@
 		return 0;
 
 	/* (2) save root nodes */
-	ARRAY_CREATE(&ctx->roots, default_pool, I_MIN(128, hdr->record_count));
+	i_array_init(&ctx->roots, I_MIN(128, hdr->record_count));
 	for (idx = 1; idx <= hdr->record_count; idx++) {
 		if (mail_thread_rec_idx(ctx, idx, &rec) < 0)
 			return -1;
@@ -1925,7 +1925,7 @@
 		ctx->msgid_hash = tbox->msgid_hash;
 		ctx->msgid_pool =
 			pool_alloconly_create("msgids", 20 * APPROX_MSGID_SIZE);
-		ARRAY_CREATE(&ctx->msgid_map, default_pool, 20);
+		i_array_init(&ctx->msgid_map, 20);
 		ctx->tmp_mail = mail_alloc(mt, 0, NULL);
 	} else if (data == NULL) {
 		/* deinit */
--- a/src/lib-dict/dict.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/lib-dict/dict.c	Sun Sep 10 15:48:12 2006 +0300
@@ -23,7 +23,7 @@
 void dict_driver_register(struct dict *driver)
 {
 	if (!array_is_created(&dict_drivers))
-		ARRAY_CREATE(&dict_drivers, default_pool, 8);
+		i_array_init(&dict_drivers, 8);
 
 	if (dict_driver_lookup(driver->name) != NULL) {
 		i_fatal("dict_driver_register(%s): Already registered",
--- a/src/lib-index/mail-cache-transaction.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/lib-index/mail-cache-transaction.c	Sun Sep 10 15:48:12 2006 +0300
@@ -57,7 +57,7 @@
 	ctx->cache = view->cache;
 	ctx->view = view;
 	ctx->trans = t;
-	ARRAY_CREATE(&ctx->reservations, default_pool, 32);
+	i_array_init(&ctx->reservations, 32);
 
 	if (!MAIL_CACHE_IS_UNUSABLE(ctx->cache))
 		ctx->cache_file_seq = ctx->cache->hdr->file_seq;
@@ -549,7 +549,7 @@
 		ctx->cache_data =
 			buffer_create_dynamic(default_pool,
 					      MAIL_CACHE_WRITE_BUFFER);
-		ARRAY_CREATE(&ctx->cache_data_seq, default_pool, 64);
+		i_array_init(&ctx->cache_data_seq, 64);
 	}
 
 	memset(&new_rec, 0, sizeof(new_rec));
@@ -835,7 +835,7 @@
 	   able to ask cached data from messages that have already been
 	   expunged. */
 	t_push();
-	ARRAY_CREATE(&tmp_offsets, pool_datastack_create(), 8);
+	t_array_init(&tmp_offsets, 8);
 	array_append(&tmp_offsets, &offset, 1);
 	for (;;) {
 		cache->hdr_copy.deleted_space += cache_rec->size;
--- a/src/lib-index/mail-cache.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/lib-index/mail-cache.c	Sun Sep 10 15:48:12 2006 +0300
@@ -528,7 +528,7 @@
 	view = i_new(struct mail_cache_view, 1);
 	view->cache = cache;
 	view->view = iview;
-	ARRAY_CREATE(&view->tmp_offsets, default_pool, 32);
+	i_array_init(&view->tmp_offsets, 32);
 	view->cached_exists_buf =
 		buffer_create_dynamic(default_pool,
 				      cache->file_fields_count + 10);
--- a/src/lib-index/mail-index-sync-ext.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/lib-index/mail-index-sync-ext.c	Sun Sep 10 15:48:12 2006 +0300
@@ -27,7 +27,7 @@
 	if (array_is_created(&ctx->expunge_handlers))
 		array_clear(&ctx->expunge_handlers);
 	else
-		ARRAY_CREATE(&ctx->expunge_handlers, default_pool, 64);
+		i_array_init(&ctx->expunge_handlers, 64);
 
 	rext = array_get(&ctx->view->index->extensions, &rext_count);
 	ext = array_get(&ctx->view->map->extensions, &ext_count);
@@ -87,9 +87,8 @@
 
 	if (array_is_created(&ctx->extra_contexts))
 		array_clear(&ctx->extra_contexts);
-	else {
-		ARRAY_CREATE(&ctx->extra_contexts, default_pool, count);
-	}
+	else
+		i_array_init(&ctx->extra_contexts, count);
 
 	/* fill the context array with NULLs */
 	(void)array_idx_modifiable(&ctx->extra_contexts, count - 1);
--- a/src/lib-index/mail-index-sync.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/lib-index/mail-index-sync.c	Sun Sep 10 15:48:12 2006 +0300
@@ -215,7 +215,7 @@
 	   arrays so we can easily go through all of the changes. */
 	keyword_count = !array_is_created(&ctx->trans->keyword_updates) ? 0 :
 		array_count(&ctx->trans->keyword_updates);
-	ARRAY_CREATE(&ctx->sync_list, default_pool, keyword_count + 2);
+	i_array_init(&ctx->sync_list, keyword_count + 2);
 
 	if (array_is_created(&ctx->trans->expunges)) {
 		synclist = array_append_space(&ctx->sync_list);
--- a/src/lib-index/mail-index-transaction.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/lib-index/mail-index-transaction.c	Sun Sep 10 15:48:12 2006 +0300
@@ -391,9 +391,8 @@
 
 	t->log_updates = TRUE;
 
-	if (!array_is_created(&t->appends)) {
-		ARRAY_CREATE(&t->appends, default_pool, 32);
-	}
+	if (!array_is_created(&t->appends))
+		i_array_init(&t->appends, 32);
 
 	/* sequence number is visible only inside given view,
 	   so let it generate it */
@@ -614,7 +613,7 @@
 	}
 
 	if (!array_is_created(&t->updates)) {
-		ARRAY_CREATE(&t->updates, default_pool, 256);
+		i_array_init(&t->updates, 256);
 		array_append(&t->updates, &u, 1);
 		return;
 	}
@@ -720,7 +719,7 @@
 	t->log_updates = TRUE;
 
 	if (!array_is_created(&t->ext_resizes))
-		ARRAY_CREATE(&t->ext_resizes, default_pool, ext_id + 2);
+		i_array_init(&t->ext_resizes, ext_id + 2);
 
 	intro.hdr_size = hdr_size;
 	intro.record_size = record_size;
@@ -747,7 +746,7 @@
 	}
 
 	if (!array_is_created(&t->ext_resets))
-		ARRAY_CREATE(&t->ext_resets, default_pool, ext_id + 2);
+		i_array_init(&t->ext_resets, ext_id + 2);
 	array_idx_set(&t->ext_resets, ext_id, &reset_id);
 }
 
@@ -790,7 +789,7 @@
 	}
 
 	if (!array_is_created(&t->ext_rec_updates))
-		ARRAY_CREATE(&t->ext_rec_updates, default_pool, ext_id + 2);
+		i_array_init(&t->ext_rec_updates, ext_id + 2);
 	array = array_idx_modifiable(&t->ext_rec_updates, ext_id);
 
 	/* @UNSAFE */
@@ -880,7 +879,7 @@
 	if (!array_is_created(&t->keyword_updates) && keywords->count > 0) {
 		uint32_t max_idx = keywords->idx[keywords->count-1];
 
-		ARRAY_CREATE(&t->keyword_updates, default_pool, max_idx + 1);
+		i_array_init(&t->keyword_updates, max_idx + 1);
 	}
 
 	/* Update add_seq and remove_seq arrays which describe the keyword
--- a/src/lib-index/mail-index-view-sync.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/lib-index/mail-index-view-sync.c	Sun Sep 10 15:48:12 2006 +0300
@@ -123,7 +123,7 @@
 	if (view_sync_set_log_view_range(view, MAIL_TRANSACTION_EXPUNGE) < 0)
 		return -1;
 
-	ARRAY_CREATE(expunges_r, default_pool, 64);
+	i_array_init(expunges_r, 64);
 	while ((ret = mail_transaction_log_view_next(view->log_view,
 						     &hdr, &data, NULL)) > 0) {
 		i_assert((hdr->type & MAIL_TRANSACTION_EXPUNGE) != 0);
@@ -596,7 +596,7 @@
 	struct mail_index_view_log_sync_pos *pos;
 
 	if (!array_is_created(sync_arr))
-		ARRAY_CREATE(sync_arr, default_pool, 32);
+		i_array_init(sync_arr, 32);
 
 	pos = array_append_space(sync_arr);
 	pos->log_file_seq = log_file_seq;
--- a/src/lib-index/mail-index-view.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/lib-index/mail-index-view.c	Sun Sep 10 15:48:12 2006 +0300
@@ -145,7 +145,7 @@
 				return;
 		}
 	} else {
-		ARRAY_CREATE(&view->map_refs, default_pool, 4);
+		i_array_init(&view->map_refs, 4);
 	}
 
 	/* reference the given mapping. the reference is dropped when the view
--- a/src/lib-index/mail-index.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/lib-index/mail-index.c	Sun Sep 10 15:48:12 2006 +0300
@@ -34,8 +34,8 @@
 	index->fd = -1;
 
 	index->extension_pool = pool_alloconly_create("extension", 512);
-	ARRAY_CREATE(&index->extensions, index->extension_pool, 5);
-	ARRAY_CREATE(&index->sync_lost_handlers, default_pool, 4);
+	p_array_init(&index->extensions, index->extension_pool, 5);
+	i_array_init(&index->sync_lost_handlers, 4);
 	array_create(&index->mail_index_module_contexts, default_pool,
 		     sizeof(void *), I_MIN(5, mail_index_module_id));
 
@@ -45,7 +45,7 @@
 	index->keywords_ext_id =
 		mail_index_ext_register(index, "keywords", 128, 2, 1);
 	index->keywords_pool = pool_alloconly_create("keywords", 512);
-	ARRAY_CREATE(&index->keywords, default_pool, 16);
+	i_array_init(&index->keywords, 16);
 	index->keywords_hash =
 		hash_create(default_pool, index->keywords_pool, 0,
 			    strcase_hash, (hash_cmp_callback_t *)strcasecmp);
@@ -208,8 +208,8 @@
 		}
 	}
 
-	ARRAY_CREATE(&map->extensions, map->extension_pool, initial_count);
-	ARRAY_CREATE(&map->ext_id_map, map->extension_pool, initial_count);
+	p_array_init(&map->extensions, map->extension_pool, initial_count);
+	p_array_init(&map->ext_id_map, map->extension_pool, initial_count);
 }
 
 uint32_t mail_index_map_lookup_ext(struct mail_index_map *map, const char *name)
@@ -462,10 +462,8 @@
 	}
 
 	/* create file -> index mapping */
-	if (!array_is_created(&map->keyword_idx_map)) {
-		ARRAY_CREATE(&map->keyword_idx_map, default_pool,
-			     kw_hdr->keywords_count);
-	}
+	if (!array_is_created(&map->keyword_idx_map)) 
+		i_array_init(&map->keyword_idx_map, kw_hdr->keywords_count);
 
 #ifdef DEBUG
 	/* Check that existing headers are still the same. It's behind DEBUG
--- a/src/lib-sql/driver-mysql.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/lib-sql/driver-mysql.c	Sun Sep 10 15:48:12 2006 +0300
@@ -252,7 +252,7 @@
 	db = p_new(pool, struct mysql_db, 1);
 	db->pool = pool;
 	db->api = driver_mysql_db;
-	ARRAY_CREATE(&db->connections, pool, 6);
+	p_array_init(&db->connections, pool, 6);
 
 	driver_mysql_parse_connect_string(db, connect_string);
 	return &db->api;
--- a/src/lib-sql/sql-api.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/lib-sql/sql-api.c	Sun Sep 10 15:48:12 2006 +0300
@@ -8,7 +8,7 @@
 
 void sql_drivers_init(void)
 {
-	ARRAY_CREATE(&sql_drivers, default_pool, 8);
+	i_array_init(&sql_drivers, 8);
 }
 
 void sql_drivers_deinit(void)
--- a/src/lib-storage/index/dbox/dbox-keywords.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/lib-storage/index/dbox/dbox-keywords.c	Sun Sep 10 15:48:12 2006 +0300
@@ -32,10 +32,8 @@
 		array_clear(&file->idx_file_keywords);
 		array_clear(&file->file_idx_keywords);
 	} else {
-		ARRAY_CREATE(&file->idx_file_keywords, default_pool,
-			     file->keyword_count);
-		ARRAY_CREATE(&file->file_idx_keywords, default_pool,
-			     file->keyword_count);
+		i_array_init(&file->idx_file_keywords, file->keyword_count);
+		i_array_init(&file->file_idx_keywords, file->keyword_count);
 	}
 
 	/* currently we assume that all extra space at the end of header
--- a/src/lib-storage/index/dbox/dbox-save.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/lib-storage/index/dbox/dbox-save.c	Sun Sep 10 15:48:12 2006 +0300
@@ -51,7 +51,7 @@
 	/* Get a list of all new keywords. Using seq_range is the easiest
 	   way to do this and should be pretty fast too. */
 	t_push();
-	ARRAY_CREATE(&new_keywords, pool_datastack_create(), 16);
+	t_array_init(&new_keywords, 16);
 	for (i = 0; i < keywords->count; i++) {
 		/* check if it's already in the file */
 		if (dbox_file_lookup_keyword(ctx->mbox, ctx->file,
--- a/src/lib-storage/index/dbox/dbox-sync-expunge.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/lib-storage/index/dbox/dbox-sync-expunge.c	Sun Sep 10 15:48:12 2006 +0300
@@ -148,8 +148,7 @@
 	lock_path = file_dotlock_get_lock_path(dotlock);
 
 	memset(&dest_entry, 0, sizeof(dest_entry));
-	ARRAY_CREATE(&dest_entry.uid_list, pool_datastack_create(),
-		     array_count(&orig_entry->uid_list));
+	t_array_init(&dest_entry.uid_list, array_count(&orig_entry->uid_list));
 	dest_entry.file_seq = file_seq;
 
 	/* write file header */
--- a/src/lib-storage/index/dbox/dbox-sync-full.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/lib-storage/index/dbox/dbox-sync-full.c	Sun Sep 10 15:48:12 2006 +0300
@@ -88,8 +88,7 @@
 	mail_index_update_flags(ctx->trans, seq, MODIFY_REPLACE, flags);
 
 	t_push();
-	ARRAY_CREATE(&keywords_arr, pool_datastack_create(),
-		     mbox->file->keyword_count);
+	t_array_init(&keywords_arr, mbox->file->keyword_count);
 	if (dbox_mail_get_keywords(mbox, mbox->file, &keywords_arr) < 0) {
 		t_pop();
 		return -1;
@@ -130,7 +129,7 @@
 
 	memset(&entry, 0, sizeof(entry));
 	entry.file_seq = file_seq;
-	ARRAY_CREATE(&entry.uid_list, pool_datastack_create(), 64);
+	t_array_init(&entry.uid_list, 64);
 
 	if (mbox->file->seeked_mail_header.expunged != '0') {
 		/* first mail expunged */
@@ -214,7 +213,7 @@
 	ctx->mail_index_next_uid = hdr->next_uid;
 
 	dbox_uidlist_sync_from_scratch(ctx->uidlist_sync_ctx);
-	ARRAY_CREATE(&ctx->exists, default_pool, 128);
+	i_array_init(&ctx->exists, 128);
 
 	while ((dp = readdir(dirp)) != NULL) {
 		if (strncmp(dp->d_name, DBOX_MAIL_FILE_PREFIX,
--- a/src/lib-storage/index/dbox/dbox-sync.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/lib-storage/index/dbox/dbox-sync.c	Sun Sep 10 15:48:12 2006 +0300
@@ -64,7 +64,7 @@
 	if (entry == NULL) {
 		entry = p_new(ctx->pool, struct dbox_sync_file_entry, 1);
 		entry->file_seq = file_seq;
-		ARRAY_CREATE(&entry->sync_recs, ctx->pool, 3);
+		p_array_init(&entry->sync_recs, ctx->pool, 3);
 		hash_insert(ctx->syncs, POINTER_CAST(file_seq), entry);
 	}
 
@@ -327,7 +327,7 @@
 	/* Get a list of all new keywords. Using seq_range is the easiest
 	   way to do this and should be pretty fast too. */
 	t_push();
-	ARRAY_CREATE(&keywords, pool_datastack_create(), 16);
+	t_array_init(&keywords, 16);
 	sync_recs = array_get(&entry->sync_recs, &count);
 	for (; i < count; i++) {
 		if (sync_recs[i].type != MAIL_INDEX_SYNC_TYPE_KEYWORD_ADD)
@@ -422,7 +422,7 @@
 	/* read all changes and sort them to file_seq order */
 	ctx->pool = pool_alloconly_create("dbox sync pool", 10240);
 	ctx->syncs = hash_create(default_pool, ctx->pool, 0, NULL, NULL);
-	ARRAY_CREATE(&ctx->added_file_seqs, default_pool, 64);
+	i_array_init(&ctx->added_file_seqs, 64);
 	for (;;) {
 		ret = mail_index_sync_next(ctx->index_sync_ctx, &sync_rec);
 		if (ret <= 0) {
--- a/src/lib-storage/index/dbox/dbox-uidlist.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/lib-storage/index/dbox/dbox-uidlist.c	Sun Sep 10 15:48:12 2006 +0300
@@ -122,7 +122,7 @@
 	uidlist->path =
 		i_strconcat(mbox->path, "/"DBOX_MAILDIR_NAME"/"
 			    DBOX_UIDLIST_FILENAME, NULL);
-	ARRAY_CREATE(&uidlist->entries, default_pool, 64);
+	i_array_init(&uidlist->entries, 64);
 	return uidlist;
 }
 
@@ -242,7 +242,7 @@
 	/* <uid list> <file seq> [<last write timestamp> <file size>] */
 	t_push();
 	entry = t_new(struct dbox_uidlist_entry, 1);
-	ARRAY_CREATE(&entry->uid_list, uidlist->entry_pool, 8);
+	p_array_init(&entry->uid_list, uidlist->entry_pool, 8);
 
 	/* get uid list */
 	range.seq1 = range.seq2 = 0;
@@ -552,7 +552,7 @@
 	ctx->uidlist = uidlist;
 	ctx->min_usable_timestamp =
 		get_min_timestamp(uidlist->mbox->rotate_days);
-	ARRAY_CREATE(&ctx->files, pool, 16);
+	p_array_init(&ctx->files, pool, 16);
 	return ctx;
 }
 
@@ -1168,7 +1168,7 @@
         save_file->dotlock = dotlock;
 	save_file->dev = st.st_dev;
 	save_file->ino = st.st_ino;
-	ARRAY_CREATE(&save_file->seqs, ctx->pool, 8);
+	p_array_init(&save_file->seqs, ctx->pool, 8);
 
 	array_append(&ctx->files, &save_file, 1);
         *file_r = file;
@@ -1330,7 +1330,7 @@
 			  struct dbox_uidlist_entry, 1);
 	*new_entry = *entry;
 
-	ARRAY_CREATE(&new_entry->uid_list, ctx->uidlist->entry_pool,
+	p_array_init(&new_entry->uid_list, ctx->uidlist->entry_pool,
 		     array_count(&entry->uid_list) + 1);
 	array_append_array(&new_entry->uid_list, &entry->uid_list);
 
--- a/src/lib-storage/index/index-mail-headers.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/lib-storage/index/index-mail-headers.c	Sun Sep 10 15:48:12 2006 +0300
@@ -181,9 +181,9 @@
 	mail->header_seq = mail->data.seq;
 	if (mail->header_data == NULL) {
 		mail->header_data = buffer_create_dynamic(default_pool, 4096);
-		ARRAY_CREATE(&mail->header_lines, default_pool, 32);
-		ARRAY_CREATE(&mail->header_match, default_pool, 32);
-		ARRAY_CREATE(&mail->header_match_lines, default_pool, 32);
+		i_array_init(&mail->header_lines, 32);
+		i_array_init(&mail->header_match, 32);
+		i_array_init(&mail->header_match_lines, 32);
 	} else {
 		buffer_set_used_size(mail->header_data, 0);
 		array_clear(&mail->header_lines);
@@ -486,7 +486,7 @@
 	i_assert(*line_idx != 0);
 	first_line_idx = *line_idx - 1;
 
-	ARRAY_CREATE(&header_values, mail->data_pool, 4);
+	p_array_init(&header_values, mail->data_pool, 4);
 	header = buffer_get_data(mail->header_data, NULL);
 
 	lines = array_get(&mail->header_lines, &lines_count);
@@ -562,7 +562,7 @@
 		return p_new(mail->data_pool, const char *, 1);
 	}
 
-	ARRAY_CREATE(&header_values, mail->data_pool, 4);
+	p_array_init(&header_values, mail->data_pool, 4);
 
 	/* cached. skip "header name: " parts in dest. */
 	for (i = 0; i < len; i++) {
--- a/src/lib-storage/index/index-mail.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/lib-storage/index/index-mail.c	Sun Sep 10 15:48:12 2006 +0300
@@ -147,7 +147,7 @@
 		return array_get(&data->keywords, NULL);
 
 	t_push();
-	ARRAY_CREATE(&keyword_indexes_arr, pool_datastack_create(), 128);
+	t_array_init(&keyword_indexes_arr, 128);
 	if (mail_index_lookup_keywords(mail->ibox->view, mail->data.seq,
 				       &keyword_indexes_arr) < 0) {
 		mail_storage_set_index_error(mail->ibox);
@@ -162,7 +162,7 @@
 	}
 
 	names = array_get(mail->ibox->keyword_names, &names_count);
-	ARRAY_CREATE(&data->keywords, mail->data_pool, count);
+	p_array_init(&data->keywords, mail->data_pool, count);
 	for (i = 0; i < count; i++) {
 		const char *name;
 		i_assert(keyword_indexes[i] < names_count);
--- a/src/lib-storage/index/index-sort.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/lib-storage/index/index-sort.c	Sun Sep 10 15:48:12 2006 +0300
@@ -97,7 +97,7 @@
 	program->temp_mail = mail_alloc(t, 0, NULL);
 	program->reverse =
 		(program->sort_program[0] & MAIL_SORT_FLAG_REVERSE) != 0;
-	ARRAY_CREATE(&program->nodes, default_pool, 64);
+	i_array_init(&program->nodes, 64);
 
 	for (i = 0; i < MAX_SORT_PROGRAM_SIZE; i++) {
 		program->sort_program[i] = sort_program[i];
@@ -696,7 +696,7 @@
 	/* we're not returning all the mails. have to create a temporary array
 	   for all the nodes so we can set all the missing sort_ids. */
 	hdr = mail_index_get_header(t->ibox->view);
-	ARRAY_CREATE(&program->all_nodes, default_pool, hdr->messages_count);
+	i_array_init(&program->all_nodes, hdr->messages_count);
 	ret = index_sort_build(program, hdr->messages_count);
 	array_free(&program->all_nodes);
 	if (ret < 0)
--- a/src/lib-storage/index/maildir/maildir-keywords.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/lib-storage/index/maildir/maildir-keywords.c	Sun Sep 10 15:48:12 2006 +0300
@@ -53,7 +53,7 @@
 	mk->path = i_strconcat(mbox->control_dir,
 			       "/" MAILDIR_KEYWORDS_NAME, NULL);
 	mk->pool = pool_alloconly_create("maildir keywords", 256);
-	ARRAY_CREATE(&mk->list, default_pool, MAILDIR_MAX_KEYWORDS);
+	i_array_init(&mk->list, MAILDIR_MAX_KEYWORDS);
 	mk->hash = hash_create(default_pool, mk->pool, 0,
 			       strcase_hash, (hash_cmp_callback_t *)strcasecmp);
 	return mk;
@@ -317,7 +317,7 @@
 	ctx->mk = mk;
 	ctx->index = index;
 	ctx->keywords = mail_index_get_keywords(index);
-	ARRAY_CREATE(&ctx->idx_to_chr, default_pool, MAILDIR_MAX_KEYWORDS);
+	i_array_init(&ctx->idx_to_chr, MAILDIR_MAX_KEYWORDS);
 	return ctx;
 }
 
--- a/src/lib-storage/index/maildir/maildir-storage.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/lib-storage/index/maildir/maildir-storage.c	Sun Sep 10 15:48:12 2006 +0300
@@ -799,7 +799,7 @@
 	   is being modified. this doesn't protect against modifications by
 	   other processes though. */
 	pool = pool_alloconly_create("Maildir subfolders list", 1024);
-	ARRAY_CREATE(&names_arr, default_pool, 64);
+	i_array_init(&names_arr, 64);
 	ctx = maildir_mailbox_list_init(&storage->storage, oldname,
 					MAILDIR_FS_SEP_S"*",
 					MAILBOX_LIST_FAST_FLAGS);
--- a/src/lib-storage/index/maildir/maildir-sync.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/lib-storage/index/maildir/maildir-sync.c	Sun Sep 10 15:48:12 2006 +0300
@@ -412,7 +412,7 @@
 	fname++;
 	dir = t_strdup_until(path, fname);
 
-	ARRAY_CREATE(&keywords, pool_datastack_create(), 16);
+	t_array_init(&keywords, 16);
 	(void)maildir_filename_get_flags(ctx->keywords_sync_ctx,
 					 fname, &flags, &keywords);
 	flags8 = flags;
@@ -583,7 +583,7 @@
 	if (ret <= 0)
 		return ret;
 
-	ARRAY_CREATE(&ctx->sync_recs, pool_datastack_create(), 32);
+	t_array_init(&ctx->sync_recs, 32);
 	do {
 		if (maildir_sync_record(ctx, &sync_rec) < 0)
 			return -1;
@@ -963,9 +963,8 @@
 		mail_index_transaction_begin(sync_ctx->view, FALSE, TRUE);
 
 	seq = 0;
-	ARRAY_CREATE(&keywords, pool_datastack_create(), MAILDIR_MAX_KEYWORDS);
-	ARRAY_CREATE(&idx_keywords, pool_datastack_create(),
-		     MAILDIR_MAX_KEYWORDS);
+	t_array_init(&keywords, MAILDIR_MAX_KEYWORDS);
+	t_array_init(&idx_keywords, MAILDIR_MAX_KEYWORDS);
 	iter = maildir_uidlist_iter_init(mbox->uidlist);
 	while (maildir_uidlist_iter_next(iter, &uid, &uflags, &filename)) {
 		maildir_filename_get_flags(sync_ctx->keywords_sync_ctx,
--- a/src/lib-storage/index/mbox/mbox-sync-parse.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/lib-storage/index/mbox/mbox-sync-parse.c	Sun Sep 10 15:48:12 2006 +0300
@@ -269,7 +269,7 @@
 	/* read keyword indexes to temporary array first */
 	t_push();
 	keyword = t_str_new(128);
-	ARRAY_CREATE(&keyword_list, pool_datastack_create(), 16);
+	t_array_init(&keyword_list, 16);
 
 	for (pos = 0; pos < hdr->full_value_len; ) {
 		if (IS_LWSP_LF(hdr->full_value[pos])) {
@@ -310,7 +310,7 @@
 	/* once we know how many keywords there are, we can allocate the array
 	   from mail_keyword_pool without wasting memory. */
 	if (array_count(&keyword_list) > 0) {
-		ARRAY_CREATE(&ctx->mail.keywords,
+		p_array_init(&ctx->mail.keywords,
 			     ctx->sync_ctx->mail_keyword_pool,
 			     array_count(&keyword_list));
 		array_append_array(&ctx->mail.keywords, &keyword_list);
--- a/src/lib-storage/index/mbox/mbox-sync-update.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/lib-storage/index/mbox/mbox-sync-update.c	Sun Sep 10 15:48:12 2006 +0300
@@ -437,7 +437,7 @@
 		}
 	} else if (!array_is_created(&ctx->mail.keywords)) {
 		/* adding first keywords */
-		ARRAY_CREATE(&ctx->mail.keywords,
+		p_array_init(&ctx->mail.keywords,
 			     ctx->sync_ctx->mail_keyword_pool,
 			     array_count(&mail->keywords));
 		array_append_array(&ctx->mail.keywords,
--- a/src/lib-storage/index/mbox/mbox-sync.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/lib-storage/index/mbox/mbox-sync.c	Sun Sep 10 15:48:12 2006 +0300
@@ -253,7 +253,7 @@
 					break;
 
 				/* adding, create the array */
-				ARRAY_CREATE(&mail->keywords,
+				p_array_init(&mail->keywords,
 					     sync_ctx->mail_keyword_pool,
 					     I_MIN(10, count - i));
 			}
@@ -462,7 +462,7 @@
 
 		/* get old keywords */
 		t_push();
-		ARRAY_CREATE(&idx_mail.keywords, pool_datastack_create(), 32);
+		t_array_init(&idx_mail.keywords, 32);
 		if (mail_index_lookup_keywords(sync_ctx->sync_view,
 					       sync_ctx->idx_seq,
 					       &idx_mail.keywords) < 0) {
@@ -1642,8 +1642,8 @@
 	/* make sure we've read the latest keywords in index */
 	(void)mail_index_get_keywords(mbox->ibox.index);
 
-	ARRAY_CREATE(&sync_ctx.mails, default_pool, 64);
-	ARRAY_CREATE(&sync_ctx.syncs, default_pool, 32);
+	i_array_init(&sync_ctx.mails, 64);
+	i_array_init(&sync_ctx.syncs, 32);
 
 	sync_ctx.flags = flags;
 	sync_ctx.delay_writes = delay_writes || sync_ctx.mbox->mbox_readonly;
--- a/src/lib-storage/mail-storage.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/lib-storage/mail-storage.c	Sun Sep 10 15:48:12 2006 +0300
@@ -33,7 +33,7 @@
 
 void mail_storage_init(void)
 {
-	ARRAY_CREATE(&storages, default_pool, 8);
+	i_array_init(&storages, 8);
 
 	mail_storage_mail_index_module_id = mail_index_module_id++;
 }
--- a/src/lib/array.h	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/lib/array.h	Sun Sep 10 15:48:12 2006 +0300
@@ -13,7 +13,7 @@
 	...
    };
 
-   ARRAY_CREATE(&foo->bars, default_pool, 10);
+   i_array_init(&foo->bars, 10);
 
    struct bar *bar = array_idx(&foo->bars, 5);
    struct baz *baz = array_idx(&foo->bars, 5); // compiler warning
@@ -32,8 +32,12 @@
 #include "array-decl.h"
 #include "buffer.h"
 
-#define ARRAY_CREATE(array, pool, init_count) \
+#define p_array_init(array, pool, init_count) \
 	array_create(array, pool, sizeof(*(array)->v), init_count);
+#define i_array_init(array, init_count) \
+	p_array_init(array, default_pool, init_count)
+#define t_array_init(array, init_count) \
+	p_array_init(array, pool_datastack_create(), init_count)
 
 #ifdef __GNUC__
 #  define ARRAY_TYPE_CAST_CONST(array) \
--- a/src/lib/ioloop-epoll.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/lib/ioloop-epoll.c	Sun Sep 10 15:48:12 2006 +0300
@@ -32,8 +32,8 @@
 	ioloop->handler_context = ctx =
 		p_new(ioloop->pool, struct ioloop_handler_context, 1);
 
-	ARRAY_CREATE(&ctx->events, ioloop->pool, IOLOOP_INITIAL_FD_COUNT);
-	ARRAY_CREATE(&ctx->fd_index, ioloop->pool, IOLOOP_INITIAL_FD_COUNT);
+	p_array_init(&ctx->events, ioloop->pool, IOLOOP_INITIAL_FD_COUNT);
+	p_array_init(&ctx->fd_index, ioloop->pool, IOLOOP_INITIAL_FD_COUNT);
 
 	ctx->epfd = epoll_create(IOLOOP_INITIAL_FD_COUNT);
 	if (ctx->epfd < 0)
--- a/src/lib/ioloop-kqueue.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/lib/ioloop-kqueue.c	Sun Sep 10 15:48:12 2006 +0300
@@ -42,7 +42,7 @@
 		i_fatal("kqueue() in io_loop_handler_init() failed: %m");
 	fd_close_on_exec(ctx->kq, TRUE);
 
-	ARRAY_CREATE(&ctx->events, ioloop->pool, IOLOOP_INITIAL_FD_COUNT);
+	p_array_init(&ctx->events, ioloop->pool, IOLOOP_INITIAL_FD_COUNT);
 }
 
 void io_loop_handler_deinit(struct ioloop *ioloop)
--- a/src/lib/module-dir.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/lib/module-dir.c	Sun Sep 10 15:48:12 2006 +0300
@@ -178,7 +178,7 @@
 	}
 
 	pool = pool_alloconly_create("module loader", 1024);
-	ARRAY_CREATE(&names, pool, 32);
+	p_array_init(&names, pool, 32);
 
 	modules = NULL;
 	while ((d = readdir(dirp)) != NULL) {
--- a/src/lib/seq-range-array.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/lib/seq-range-array.c	Sun Sep 10 15:48:12 2006 +0300
@@ -40,7 +40,7 @@
 	value.seq1 = value.seq2 = seq;
 
 	if (!array_is_created(array))
-		ARRAY_CREATE(array, default_pool, init_count);
+		i_array_init(array, init_count);
 
 	data = array_get_modifiable(array, &count);
 	if (count == 0) {
--- a/src/master/mail-process.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/master/mail-process.c	Sun Sep 10 15:48:12 2006 +0300
@@ -414,7 +414,7 @@
 		return FALSE;
 	}
 
-	ARRAY_CREATE(&extra_args, pool_datastack_create(), 16);
+	t_array_init(&extra_args, 16);
 	mail = home_dir = chroot_dir = system_user = "";
 	uid = gid = 0; nice = 0;
 	home_given = FALSE;
--- a/src/master/master-settings.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/master/master-settings.c	Sun Sep 10 15:48:12 2006 +0300
@@ -1136,9 +1136,9 @@
 	*server->imap = *imap_defaults;
 	*server->pop3 = *pop3_defaults;
 
-	ARRAY_CREATE(&server->dicts, settings_pool, 4);
-	ARRAY_CREATE(&server->imap->plugin_envs, settings_pool, 8);
-	ARRAY_CREATE(&server->pop3->plugin_envs, settings_pool, 8);
+	p_array_init(&server->dicts, settings_pool, 4);
+	p_array_init(&server->imap->plugin_envs, settings_pool, 8);
+	p_array_init(&server->pop3->plugin_envs, settings_pool, 8);
 
 	server->imap->server = server;
 	server->imap->protocol = MAIL_PROTOCOL_IMAP;
--- a/src/plugins/acl/acl-backend-vfile.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/plugins/acl/acl-backend-vfile.c	Sun Sep 10 15:48:12 2006 +0300
@@ -124,7 +124,7 @@
 	while (*acl == ' ' || *acl == '\t')
 		acl++;
 
-	ARRAY_CREATE(&rights, pool_datastack_create(), 64);
+	t_array_init(&rights, 64);
 	for (; *acl != '\0' && *acl != ':'; acl++) {
 		for (i = 0; acl_letter_map[i].letter != '\0'; i++) {
 			if (acl_letter_map[i].letter == *acl)
--- a/src/plugins/acl/acl-cache.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/plugins/acl/acl-cache.c	Sun Sep 10 15:48:12 2006 +0300
@@ -53,8 +53,7 @@
 	cache->right_name_idx_map =
 		hash_create(default_pool, cache->right_names_pool, 0,
 			    str_hash, (hash_cmp_callback_t *)strcmp);
-	ARRAY_CREATE(&cache->right_idx_name_map, default_pool,
-		     DEFAULT_ACL_RIGHTS_COUNT);
+	i_array_init(&cache->right_idx_name_map, DEFAULT_ACL_RIGHTS_COUNT);
 	return cache;
 }
 
--- a/src/plugins/expire/expire-env.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/plugins/expire/expire-env.c	Sun Sep 10 15:48:12 2006 +0300
@@ -26,7 +26,7 @@
 	names = p_strsplit(pool, str, " ");
 	len = strarray_length((const char *const *)names);
 
-	ARRAY_CREATE(&env->expire_boxes, pool, len / 2);
+	p_array_init(&env->expire_boxes, pool, len / 2);
 	for (; *names != NULL; names += 2) {
 		if (names[1] == NULL) {
 			i_fatal("expire: Missing expire days for mailbox '%s'",
--- a/src/plugins/quota/quota-dirsize.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/plugins/quota/quota-dirsize.c	Sun Sep 10 15:48:12 2006 +0300
@@ -153,7 +153,7 @@
 	bool is_file;
 
 	t_push();
-	ARRAY_CREATE(&paths, pool_datastack_create(), 8);
+	t_array_init(&paths, 8);
 	storages = array_get(&root->quota->storages, &count);
 	for (i = 0; i < count; i++) {
 		path = mail_storage_get_mailbox_path(storages[i], "", &is_file);
--- a/src/plugins/quota/quota.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/plugins/quota/quota.c	Sun Sep 10 15:48:12 2006 +0300
@@ -42,8 +42,8 @@
 
 	quota = i_new(struct quota, 1);
 	quota->test_alloc = quota_default_test_alloc;
-	ARRAY_CREATE(&quota->roots, default_pool, 4);
-	ARRAY_CREATE(&quota->storages, default_pool, 8);
+	i_array_init(&quota->roots, 4);
+	i_array_init(&quota->storages, 8);
 
 	return quota;
 }
@@ -117,7 +117,7 @@
 		root->name = "";
 	}
 
-	ARRAY_CREATE(&root->rules, default_pool, 4);
+	i_array_init(&root->rules, 4);
 	array_create(&root->quota_module_contexts, default_pool,
 		     sizeof(void *), 5);
 
--- a/src/plugins/trash/trash-plugin.c	Sun Sep 10 15:46:11 2006 +0300
+++ b/src/plugins/trash/trash-plugin.c	Sun Sep 10 15:48:12 2006 +0300
@@ -195,7 +195,7 @@
 	}
 
 	p_clear(config_pool);
-	ARRAY_CREATE(&trash_boxes, config_pool, 8);
+	p_array_init(&trash_boxes, config_pool, 8);
 
 	input = i_stream_create_file(fd, default_pool, (size_t)-1, FALSE);
 	while ((line = i_stream_read_next_line(input)) != NULL) {