changeset 6428:7cad076906eb HEAD

pool_unref() now takes ** pointer.
author Timo Sirainen <tss@iki.fi>
date Sun, 16 Sep 2007 14:04:06 +0300
parents c242677f2aa9
children 65c69a53a7be
files src/auth/auth-request-handler.c src/auth/auth-request.c src/auth/auth.c src/auth/db-ldap.c src/auth/db-passwd-file.c src/auth/db-sql.c src/auth/mech-gssapi.c src/auth/mech-rpa.c src/auth/mech.c src/auth/otp-skey-common.c src/deliver/deliver.c src/deliver/duplicate.c src/imap/client.c src/imap/cmd-append.c src/imap/cmd-sort.c src/imap/cmd-thread.c src/imap/imap-thread.c src/imap/main.c src/lib-auth/auth-server-connection.c src/lib-dict/dict-client.c src/lib-dict/dict-db.c src/lib-dict/dict-sql.c src/lib-imap/imap-parser.c src/lib-index/mail-cache.c src/lib-index/mail-index-map.c src/lib-index/mail-index.c src/lib-index/mailbox-list-index-sync.c src/lib-mail/istream-header-filter.c src/lib-mail/message-parser.c src/lib-sql/driver-mysql.c src/lib-sql/driver-sqlite.c src/lib-storage/index/dbox/dbox-file.c src/lib-storage/index/dbox/dbox-sync.c src/lib-storage/index/index-mail-headers.c src/lib-storage/index/index-mail.c src/lib-storage/index/index-search.c src/lib-storage/index/index-storage.c src/lib-storage/index/maildir/maildir-keywords.c src/lib-storage/index/maildir/maildir-save.c src/lib-storage/index/maildir/maildir-uidlist.c src/lib-storage/index/mbox/mbox-sync.c src/lib-storage/list/index-mailbox-list.c src/lib-storage/list/mailbox-list-fs-iter.c src/lib-storage/list/mailbox-list-fs.c src/lib-storage/list/mailbox-list-maildir-iter.c src/lib-storage/list/mailbox-list-maildir.c src/lib-storage/mail-storage.c src/lib-storage/mailbox-tree.c src/lib/env-util.c src/lib/mempool.h src/lib/module-dir.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/fts-squat/squat-uidlist.c src/plugins/mail-log/mail-log-plugin.c src/plugins/quota/quota.c src/plugins/trash/trash-plugin.c
diffstat 59 files changed, 84 insertions(+), 88 deletions(-) [+]
line wrap: on
line diff
--- a/src/auth/auth-request-handler.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/auth/auth-request-handler.c	Sun Sep 16 14:04:06 2007 +0300
@@ -75,7 +75,7 @@
 	handler->callback(NULL, handler->context);
 
 	hash_destroy(&handler->requests);
-	pool_unref(handler->pool);
+	pool_unref(&handler->pool);
 }
 
 void auth_request_handler_set(struct auth_request_handler *handler,
--- a/src/auth/auth-request.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/auth/auth-request.c	Sun Sep 16 14:04:06 2007 +0300
@@ -112,7 +112,7 @@
 	if (request->mech != NULL)
 		request->mech->auth_free(request);
 	else
-		pool_unref(request->pool);
+		pool_unref(&request->pool);
 }
 
 void auth_request_export(struct auth_request *request, string_t *str)
--- a/src/auth/auth.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/auth/auth.c	Sun Sep 16 14:04:06 2007 +0300
@@ -298,5 +298,5 @@
 	auth_request_handler_deinit();
 	passdb_cache_deinit();
 
-	pool_unref(auth->pool);
+	pool_unref(&auth->pool);
 }
--- a/src/auth/db-ldap.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/auth/db-ldap.c	Sun Sep 16 14:04:06 2007 +0300
@@ -1011,7 +1011,7 @@
 		hash_destroy(&conn->pass_attr_map);
 	if (conn->user_attr_map != NULL)
 		hash_destroy(&conn->user_attr_map);
-	pool_unref(conn->pool);
+	pool_unref(&conn->pool);
 }
 
 #ifndef BUILTIN_LDAP
--- a/src/auth/db-passwd-file.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/auth/db-passwd-file.c	Sun Sep 16 14:04:06 2007 +0300
@@ -218,10 +218,8 @@
 
 	if (pw->users != NULL)
 		hash_destroy(&pw->users);
-	if (pw->pool != NULL) {
-		pool_unref(pw->pool);
-		pw->pool = NULL;
-	}
+	if (pw->pool != NULL)
+		pool_unref(&pw->pool);
 }
 
 static void passwd_file_free(struct passwd_file *pw)
--- a/src/auth/db-sql.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/auth/db-sql.c	Sun Sep 16 14:04:06 2007 +0300
@@ -106,7 +106,7 @@
 		return;
 
 	sql_deinit(&conn->db);
-	pool_unref(conn->pool);
+	pool_unref(&conn->pool);
 }
 
 #endif
--- a/src/auth/mech-gssapi.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/auth/mech-gssapi.c	Sun Sep 16 14:04:06 2007 +0300
@@ -432,7 +432,7 @@
 		major_status = gss_release_name(&minor_status,
 						&gssapi_request->authz_name);
 	}
-	pool_unref(request->pool);
+	pool_unref(&request->pool);
 }
 
 const struct mech_module mech_gssapi = {
--- a/src/auth/mech-rpa.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/auth/mech-rpa.c	Sun Sep 16 14:04:06 2007 +0300
@@ -580,7 +580,7 @@
 	if (request->pwd_md5 != NULL)
 		safe_memset(request->pwd_md5, 0, sizeof(request->pwd_md5));
 
-	pool_unref(auth_request->pool);
+	pool_unref(&auth_request->pool);
 }
 
 static struct auth_request *mech_rpa_auth_new(void)
--- a/src/auth/mech.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/auth/mech.c	Sun Sep 16 14:04:06 2007 +0300
@@ -59,7 +59,7 @@
 
 void mech_generic_auth_free(struct auth_request *request)
 {
-	pool_unref(request->pool);
+	pool_unref(&request->pool);
 }
 
 extern const struct mech_module mech_plain;
--- a/src/auth/otp-skey-common.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/auth/otp-skey-common.c	Sun Sep 16 14:04:06 2007 +0300
@@ -64,5 +64,5 @@
 {
 	otp_unlock(auth_request);
 
-	pool_unref(auth_request->pool);
+	pool_unref(&auth_request->pool);
 }
--- a/src/deliver/deliver.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/deliver/deliver.c	Sun Sep 16 14:04:06 2007 +0300
@@ -405,7 +405,7 @@
 		ret = t_strdup(addr->mailbox);
 	else
 		ret = t_strdup_printf("%s@%s", addr->mailbox, addr->domain);
-	pool_unref(pool);
+	pool_unref(&pool);
 	return ret;
 }
 
--- a/src/deliver/duplicate.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/deliver/duplicate.c	Sun Sep 16 14:04:06 2007 +0300
@@ -184,7 +184,7 @@
 		file_dotlock_delete(&file->dotlock);
 
 	hash_destroy(&file->hash);
-	pool_unref(file->pool);
+	pool_unref(&file->pool);
 }
 
 int duplicate_check(const void *id, size_t id_size, const char *user)
--- a/src/imap/client.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/imap/client.c	Sun Sep 16 14:04:06 2007 +0300
@@ -142,8 +142,8 @@
 			i_error("close(client out) failed: %m");
 	}
 
-	pool_unref(client->keywords.pool);
-	pool_unref(client->command_pool);
+	pool_unref(&client->keywords.pool);
+	pool_unref(&client->command_pool);
 	i_free(client);
 
 	/* quit the program */
--- a/src/imap/cmd-append.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/imap/cmd-append.c	Sun Sep 16 14:04:06 2007 +0300
@@ -136,7 +136,7 @@
 	if (ctx->box != ctx->cmd->client->mailbox && ctx->box != NULL) {
 		mailbox_close(&ctx->box);
 
-		pool_unref(ctx->client->keywords.pool);
+		pool_unref(&ctx->client->keywords.pool);
 		ctx->client->keywords = ctx->old_keywords;
 	}
 }
--- a/src/imap/cmd-sort.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/imap/cmd-sort.c	Sun Sep 16 14:04:06 2007 +0300
@@ -132,7 +132,7 @@
 		/* error in search arguments */
 		client_send_tagline(cmd, t_strconcat("NO ", error, NULL));
 	} else if (imap_sort(cmd, charset, sargs, sorting) == 0) {
-		pool_unref(pool);
+		pool_unref(&pool);
 		return cmd_sync(cmd, MAILBOX_SYNC_FLAG_FAST |
 				(cmd->uid ? 0 : MAILBOX_SYNC_FLAG_NO_EXPUNGES),
 				0, "OK Sort completed.");
@@ -141,6 +141,6 @@
 					  mailbox_get_storage(client->mailbox));
 	}
 
-	pool_unref(pool);
+	pool_unref(&pool);
 	return TRUE;
 }
--- a/src/imap/cmd-thread.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/imap/cmd-thread.c	Sun Sep 16 14:04:06 2007 +0300
@@ -65,7 +65,7 @@
 		/* error in search arguments */
 		client_send_tagline(cmd, t_strconcat("NO ", error, NULL));
 	} else if (imap_thread(cmd, charset, sargs, threading) == 0) {
-		pool_unref(pool);
+		pool_unref(&pool);
 		return cmd_sync(cmd, MAILBOX_SYNC_FLAG_FAST |
 				(cmd->uid ? 0 : MAILBOX_SYNC_FLAG_NO_EXPUNGES),
 				0, "OK Thread completed.");
@@ -74,6 +74,6 @@
 					  mailbox_get_storage(client->mailbox));
 	}
 
-	pool_unref(pool);
+	pool_unref(&pool);
 	return TRUE;
 }
--- a/src/imap/imap-thread.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/imap/imap-thread.c	Sun Sep 16 14:04:06 2007 +0300
@@ -97,8 +97,8 @@
 	if (ctx->subject_hash != NULL)
 		hash_destroy(&ctx->subject_hash);
 
-	pool_unref(ctx->temp_pool);
-	pool_unref(ctx->pool);
+	pool_unref(&ctx->temp_pool);
+	pool_unref(&ctx->pool);
 }
 
 int imap_thread(struct client_command_context *cmd, const char *charset,
--- a/src/imap/main.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/imap/main.c	Sun Sep 16 14:04:06 2007 +0300
@@ -260,7 +260,7 @@
         mail_storage_deinit();
 	dict_driver_unregister(&dict_driver_client);
 	random_deinit();
-	pool_unref(namespace_pool);
+	pool_unref(&namespace_pool);
 
 	str_free(&capability_string);
 
--- a/src/lib-auth/auth-server-connection.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/lib-auth/auth-server-connection.c	Sun Sep 16 14:04:06 2007 +0300
@@ -306,7 +306,7 @@
 
 	i_stream_unref(&conn->input);
 	o_stream_unref(&conn->output);
-	pool_unref(conn->pool);
+	pool_unref(&conn->pool);
 }
 
 struct auth_server_connection *
--- a/src/lib-dict/dict-client.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/lib-dict/dict-client.c	Sun Sep 16 14:04:06 2007 +0300
@@ -323,7 +323,7 @@
 	struct client_dict *dict = (struct client_dict *)_dict;
 
         client_dict_disconnect(dict);
-	pool_unref(dict->pool);
+	pool_unref(&dict->pool);
 }
 
 static int client_dict_lookup(struct dict *_dict, pool_t pool,
@@ -427,7 +427,7 @@
 	struct client_dict_iterate_context *ctx =
 		(struct client_dict_iterate_context *)_ctx;
 
-	pool_unref(ctx->pool);
+	pool_unref(&ctx->pool);
 	i_free(ctx);
 	dict->in_iteration = TRUE;
 }
--- a/src/lib-dict/dict-db.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/lib-dict/dict-db.c	Sun Sep 16 14:04:06 2007 +0300
@@ -79,7 +79,7 @@
 	ret = db_env_create(&dict->db_env, 0);
 	if (ret != 0) {
 		i_error("db_env:%s\n", db_strerror(ret));
-		pool_unref(pool);
+		pool_unref(&pool);
 		return NULL;
 	}
 
@@ -93,13 +93,13 @@
 	ret = dict->db_env->open(dict->db_env, hdir, DB_CREATE | 
 				 DB_INIT_MPOOL | DB_INIT_TXN, 0);
 	if (ret != 0) {
-		pool_unref(pool);
+		pool_unref(&pool);
 		return NULL;
 	}
 
 	ret = dict->db_env->txn_begin(dict->db_env, NULL, &tid, 0);
 	if (ret != 0) {
-		pool_unref(pool);
+		pool_unref(&pool);
 		return NULL;
 	}
 
@@ -168,7 +168,7 @@
 		dict->pdb->close(dict->pdb, 0);
 	if (dict->sdb != NULL)
 		dict->sdb->close(dict->sdb, 0);
-	pool_unref(dict->pool);
+	pool_unref(&dict->pool);
 }
 
 static int db_dict_iterate_set(struct db_dict_iterate_context *ctx, int ret,
@@ -326,7 +326,7 @@
 		(struct db_dict_iterate_context *)_ctx;
 
 	ctx->cursor->c_close(ctx->cursor);
-	pool_unref(ctx->pool);
+	pool_unref(&ctx->pool);
 	i_free(ctx->path);
 	i_free(ctx);
 }
--- a/src/lib-dict/dict-sql.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/lib-dict/dict-sql.c	Sun Sep 16 14:04:06 2007 +0300
@@ -116,7 +116,7 @@
 	dict->username = p_strdup(pool, username);
 
 	if (sql_dict_read_config(dict, uri) < 0) {
-		pool_unref(pool);
+		pool_unref(&pool);
 		return NULL;
 	}
 
@@ -131,7 +131,7 @@
 	struct sql_dict *dict = (struct sql_dict *)_dict;
 
 	sql_deinit(&dict->db);
-	pool_unref(dict->pool);
+	pool_unref(&dict->pool);
 }
 
 static int sql_path_fix(const char **path, bool *private_r)
--- a/src/lib-imap/imap-parser.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/lib-imap/imap-parser.c	Sun Sep 16 14:04:06 2007 +0300
@@ -66,7 +66,7 @@
 
 void imap_parser_destroy(struct imap_parser **parser)
 {
-	pool_unref((*parser)->pool);
+	pool_unref(&(*parser)->pool);
 	i_free(*parser);
 	*parser = NULL;
 }
--- a/src/lib-index/mail-cache.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/lib-index/mail-cache.c	Sun Sep 16 14:04:06 2007 +0300
@@ -393,7 +393,7 @@
 	mail_cache_file_close(cache);
 
 	hash_destroy(&cache->field_name_hash);
-	pool_unref(cache->field_pool);
+	pool_unref(&cache->field_pool);
 	i_free(cache->field_file_map);
 	i_free(cache->file_field_map);
 	i_free(cache->fields);
--- a/src/lib-index/mail-index-map.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/lib-index/mail-index-map.c	Sun Sep 16 14:04:06 2007 +0300
@@ -963,7 +963,7 @@
 	mail_index_record_map_unlink(map);
 
 	if (map->extension_pool != NULL)
-		pool_unref(map->extension_pool);
+		pool_unref(&map->extension_pool);
 	if (array_is_created(&map->keyword_idx_map))
 		array_free(&map->keyword_idx_map);
 	buffer_free(&map->hdr_copy_buf);
--- a/src/lib-index/mail-index.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/lib-index/mail-index.c	Sun Sep 16 14:04:06 2007 +0300
@@ -62,8 +62,8 @@
 
 	mail_transaction_log_free(&index->log);
 	hash_destroy(&index->keywords_hash);
-	pool_unref(index->extension_pool);
-	pool_unref(index->keywords_pool);
+	pool_unref(&index->extension_pool);
+	pool_unref(&index->keywords_pool);
 
 	array_free(&index->sync_lost_handlers);
 	array_free(&index->keywords);
--- a/src/lib-index/mailbox-list-index-sync.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/lib-index/mailbox-list-index-sync.c	Sun Sep 16 14:04:06 2007 +0300
@@ -919,7 +919,7 @@
 	}
 
 	mailbox_list_index_view_deinit(&ctx->view);
-	pool_unref(ctx->pool);
+	pool_unref(&ctx->pool);
 	return ret;
 }
 
--- a/src/lib-mail/istream-header-filter.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/lib-mail/istream-header-filter.c	Sun Sep 16 14:04:06 2007 +0300
@@ -45,7 +45,7 @@
 	if (mstream->hdr_ctx != NULL)
 		message_parse_header_deinit(&mstream->hdr_ctx);
 	i_stream_unref(&mstream->input);
-	pool_unref(mstream->pool);
+	pool_unref(&mstream->pool);
 }
 
 static void
--- a/src/lib-mail/message-parser.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/lib-mail/message-parser.c	Sun Sep 16 14:04:06 2007 +0300
@@ -704,7 +704,7 @@
 
 	*_ctx = NULL;
 	i_stream_unref(&ctx->input);
-	pool_unref(ctx->parser_pool);
+	pool_unref(&ctx->parser_pool);
 	return parts;
 }
 
--- a/src/lib-sql/driver-mysql.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/lib-sql/driver-mysql.c	Sun Sep 16 14:04:06 2007 +0300
@@ -268,7 +268,7 @@
 	for (i = 0; i < count; i++)
 		(void)driver_mysql_connection_free(&conn[i]);
 
-	pool_unref(db->pool);
+	pool_unref(&db->pool);
 }
 
 static enum sql_db_flags
@@ -629,7 +629,7 @@
 	struct mysql_transaction_context *ctx =
 		(struct mysql_transaction_context *)_ctx;
 
-	pool_unref(ctx->query_pool);
+	pool_unref(&ctx->query_pool);
 	i_free(ctx);
 }
 
--- a/src/lib-sql/driver-sqlite.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/lib-sql/driver-sqlite.c	Sun Sep 16 14:04:06 2007 +0300
@@ -79,7 +79,7 @@
 	struct sqlite_db *db = (struct sqlite_db *)_db;
 
 	sqlite3_close(db->sqlite);
-	pool_unref(db->pool);
+	pool_unref(&db->pool);
 }
 
 static enum sql_db_flags
--- a/src/lib-storage/index/dbox/dbox-file.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/lib-storage/index/dbox/dbox-file.c	Sun Sep 16 14:04:06 2007 +0300
@@ -80,7 +80,7 @@
 	i_assert(file->refcount == 0);
 
 	if (file->metadata_pool != NULL)
-		pool_unref(file->metadata_pool);
+		pool_unref(&file->metadata_pool);
 	if (file->input != NULL)
 		i_stream_unref(&file->input);
 	if (file->output != NULL)
--- a/src/lib-storage/index/dbox/dbox-sync.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/lib-storage/index/dbox/dbox-sync.c	Sun Sep 16 14:04:06 2007 +0300
@@ -222,7 +222,7 @@
 
 	dbox_sync_unlock_files(ctx);
 	hash_destroy(&ctx->syncs);
-	pool_unref(ctx->pool);
+	pool_unref(&ctx->pool);
 	return ret;
 }
 
--- a/src/lib-storage/index/index-mail-headers.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/lib-storage/index/index-mail-headers.c	Sun Sep 16 14:04:06 2007 +0300
@@ -799,5 +799,5 @@
 	struct index_header_lookup_ctx *ctx =
 		(struct index_header_lookup_ctx *)_ctx;
 
-	pool_unref(ctx->pool);
+	pool_unref(&ctx->pool);
 }
--- a/src/lib-storage/index/index-mail.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/lib-storage/index/index-mail.c	Sun Sep 16 14:04:06 2007 +0300
@@ -1109,8 +1109,8 @@
 	if (array_is_created(&mail->header_match_lines))
 		array_free(&mail->header_match_lines);
 
-	pool_unref(mail->data_pool);
-	pool_unref(mail->mail.pool);
+	pool_unref(&mail->data_pool);
+	pool_unref(&mail->mail.pool);
 }
 
 void index_mail_cache_parse_continue(struct mail *_mail)
--- a/src/lib-storage/index/index-search.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/lib-storage/index/index-search.c	Sun Sep 16 14:04:06 2007 +0300
@@ -869,7 +869,7 @@
 				       search_arg_deinit, NULL);
 
 	if (ctx->search_pool != NULL)
-		pool_unref(ctx->search_pool);
+		pool_unref(&ctx->search_pool);
 
 	if (ctx->mail_ctx.sort_program != NULL)
 		index_sort_program_deinit(&ctx->mail_ctx.sort_program);
--- a/src/lib-storage/index/index-storage.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/lib-storage/index/index-storage.c	Sun Sep 16 14:04:06 2007 +0300
@@ -437,7 +437,7 @@
 		array_free(&ibox->recent_flags);
 	i_free(ibox->cache_fields);
 
-	pool_unref(box->pool);
+	pool_unref(&box->pool);
 	return 0;
 }
 
--- a/src/lib-storage/index/maildir/maildir-keywords.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/lib-storage/index/maildir/maildir-keywords.c	Sun Sep 16 14:04:06 2007 +0300
@@ -90,7 +90,7 @@
 	*_mk = NULL;
 	hash_destroy(&mk->hash);
 	array_free(&mk->list);
-	pool_unref(mk->pool);
+	pool_unref(&mk->pool);
 	i_free(mk->path);
 	i_free(mk);
 }
--- a/src/lib-storage/index/maildir/maildir-save.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/lib-storage/index/maildir/maildir-save.c	Sun Sep 16 14:04:06 2007 +0300
@@ -706,7 +706,7 @@
 
 	if (ctx->mail != NULL)
 		mail_free(&ctx->mail);
-	pool_unref(ctx->pool);
+	pool_unref(&ctx->pool);
 }
 
 void maildir_transaction_save_rollback(struct maildir_save_context *ctx)
@@ -754,5 +754,5 @@
 
 	if (ctx->mail != NULL)
 		mail_free(&ctx->mail);
-	pool_unref(ctx->pool);
+	pool_unref(&ctx->pool);
 }
--- a/src/lib-storage/index/maildir/maildir-uidlist.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/lib-storage/index/maildir/maildir-uidlist.c	Sun Sep 16 14:04:06 2007 +0300
@@ -241,7 +241,7 @@
 
 	hash_destroy(&uidlist->files);
 	if (uidlist->record_pool != NULL)
-		pool_unref(uidlist->record_pool);
+		pool_unref(&uidlist->record_pool);
 
 	array_free(&uidlist->records);
 	str_free(&uidlist->hdr_extensions);
@@ -1247,7 +1247,7 @@
 	ctx->files = NULL;
 
 	if (uidlist->record_pool != NULL)
-		pool_unref(uidlist->record_pool);
+		pool_unref(&uidlist->record_pool);
 	uidlist->record_pool = ctx->record_pool;
 	ctx->record_pool = NULL;
 
@@ -1297,7 +1297,7 @@
 	if (ctx->files != NULL)
 		hash_destroy(&ctx->files);
 	if (ctx->record_pool != NULL)
-		pool_unref(ctx->record_pool);
+		pool_unref(&ctx->record_pool);
 	if (array_is_created(&ctx->records))
 		array_free(&ctx->records);
 	i_free(ctx);
--- a/src/lib-storage/index/mbox/mbox-sync.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/lib-storage/index/mbox/mbox-sync.c	Sun Sep 16 14:04:06 2007 +0300
@@ -1525,8 +1525,8 @@
 	index_sync_changes_deinit(&sync_ctx->sync_changes);
 	if (sync_ctx->index_sync_ctx != NULL)
 		mail_index_sync_rollback(&sync_ctx->index_sync_ctx);
-	pool_unref(sync_ctx->mail_keyword_pool);
-	pool_unref(sync_ctx->saved_keywords_pool);
+	pool_unref(&sync_ctx->mail_keyword_pool);
+	pool_unref(&sync_ctx->saved_keywords_pool);
 	str_free(&sync_ctx->header);
 	str_free(&sync_ctx->from_line);
 	array_free(&sync_ctx->mails);
--- a/src/lib-storage/list/index-mailbox-list.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/lib-storage/list/index-mailbox-list.c	Sun Sep 16 14:04:06 2007 +0300
@@ -423,7 +423,7 @@
 	if (ctx->iter_ctx != NULL)
 		mailbox_list_index_iterate_deinit(&ctx->iter_ctx);
 	if (ctx->info_pool != NULL)
-		pool_unref(ctx->info_pool);
+		pool_unref(&ctx->info_pool);
 
 	if (ctx->mail_view != NULL)
 		mail_index_view_close(&ctx->mail_view);
--- a/src/lib-storage/list/mailbox-list-fs-iter.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/lib-storage/list/mailbox-list-fs-iter.c	Sun Sep 16 14:04:06 2007 +0300
@@ -259,7 +259,7 @@
 	if (ctx->subs_tree != NULL)
 		mailbox_tree_deinit(&ctx->subs_tree);
 	if (ctx->info_pool != NULL)
-		pool_unref(ctx->info_pool);
+		pool_unref(&ctx->info_pool);
 	if (ctx->glob != NULL)
 		imap_match_deinit(&ctx->glob);
 	i_free(ctx);
--- a/src/lib-storage/list/mailbox-list-fs.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/lib-storage/list/mailbox-list-fs.c	Sun Sep 16 14:04:06 2007 +0300
@@ -35,7 +35,7 @@
 {
 	struct fs_mailbox_list *list = (struct fs_mailbox_list *)_list;
 
-	pool_unref(list->list.pool);
+	pool_unref(&list->list.pool);
 }
 
 static bool fs_list_is_valid_common(const char *name, size_t *len_r)
--- a/src/lib-storage/list/mailbox-list-maildir-iter.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/lib-storage/list/mailbox-list-maildir-iter.c	Sun Sep 16 14:04:06 2007 +0300
@@ -280,7 +280,7 @@
 	if (ctx->tree_iter != NULL)
 		mailbox_tree_iterate_deinit(&ctx->tree_iter);
 	mailbox_tree_deinit(&ctx->tree_ctx);
-	pool_unref(ctx->pool);
+	pool_unref(&ctx->pool);
 	return ret;
 }
 
--- a/src/lib-storage/list/mailbox-list-maildir.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/lib-storage/list/mailbox-list-maildir.c	Sun Sep 16 14:04:06 2007 +0300
@@ -48,7 +48,7 @@
 	struct maildir_mailbox_list *list =
 		(struct maildir_mailbox_list *)_list;
 
-	pool_unref(list->list.pool);
+	pool_unref(&list->list.pool);
 }
 
 static const char *
@@ -369,7 +369,7 @@
 		t_pop();
 	}
 	array_free(&names_arr);
-	pool_unref(pool);
+	pool_unref(&pool);
 
 	return ret;
 }
--- a/src/lib-storage/mail-storage.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/lib-storage/mail-storage.c	Sun Sep 16 14:04:06 2007 +0300
@@ -225,7 +225,7 @@
 		}
 
 		/* try the next one */
-		pool_unref(storage->pool);
+		pool_unref(&storage->pool);
 	}
 	if (i == count) {
 		if (count <= 1) {
@@ -266,7 +266,7 @@
 
 	mailbox_list_deinit(storage->list);
 	i_free(storage->error_string);
-	pool_unref(storage->pool);
+	pool_unref(&storage->pool);
 
 	index_storage_destroy_unrefed();
 }
--- a/src/lib-storage/mailbox-tree.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/lib-storage/mailbox-tree.c	Sun Sep 16 14:04:06 2007 +0300
@@ -42,7 +42,7 @@
 	struct mailbox_tree_context *tree = *_tree;
 
 	*_tree = NULL;
-	pool_unref(tree->pool);
+	pool_unref(&tree->pool);
 }
 
 static struct mailbox_node *
--- a/src/lib/env-util.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/lib/env-util.c	Sun Sep 16 14:04:06 2007 +0300
@@ -23,8 +23,6 @@
 	if (environ != NULL)
 		*environ = NULL;
 
-	if (pool != NULL) {
-		pool_unref(pool);
-		pool = NULL;
-	}
+	if (pool != NULL)
+		pool_unref(&pool);
 }
--- a/src/lib/mempool.h	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/lib/mempool.h	Sun Sep 16 14:04:06 2007 +0300
@@ -79,7 +79,7 @@
 /* Pools should be used through these macros: */
 #define pool_get_name(pool) (pool)->v->get_name(pool)
 #define pool_ref(pool) (pool)->v->ref(pool)
-#define pool_unref(pool) (pool)->v->unref(&(pool))
+#define pool_unref(pool) ((*pool))->v->unref(pool)
 
 #define p_new(pool, type, count) \
 	((type *) p_malloc(pool, sizeof(type) * (count)))
--- a/src/lib/module-dir.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/lib/module-dir.c	Sun Sep 16 14:04:06 2007 +0300
@@ -280,7 +280,7 @@
 		}
 	}
 	t_pop();
-	pool_unref(pool);
+	pool_unref(&pool);
 
 	if (closedir(dirp) < 0)
 		i_error("closedir(%s) failed: %m", dir);
--- a/src/master/master-settings.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/master/master-settings.c	Sun Sep 16 14:04:06 2007 +0300
@@ -1739,6 +1739,6 @@
 
 void master_settings_deinit(void)
 {
-	pool_unref(settings_pool);
-	pool_unref(settings2_pool);
+	pool_unref(&settings_pool);
+	pool_unref(&settings2_pool);
 }
--- a/src/plugins/acl/acl-backend-vfile.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/plugins/acl/acl-backend-vfile.c	Sun Sep 16 14:04:06 2007 +0300
@@ -99,7 +99,7 @@
 
 static void acl_backend_vfile_deinit(struct acl_backend *backend)
 {
-	pool_unref(backend->pool);
+	pool_unref(&backend->pool);
 }
 
 static struct acl_object *
@@ -140,7 +140,7 @@
 	if (array_is_created(&aclobj->rights))
 		array_free(&aclobj->rights);
 	if (aclobj->rights_pool != NULL)
-		pool_unref(aclobj->rights_pool);
+		pool_unref(&aclobj->rights_pool);
 
 	i_free(aclobj->local_path);
 	i_free(aclobj->global_path);
--- a/src/plugins/acl/acl-cache.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/plugins/acl/acl-cache.c	Sun Sep 16 14:04:06 2007 +0300
@@ -65,7 +65,7 @@
 	array_free(&cache->right_idx_name_map);
 	hash_destroy(&cache->right_name_idx_map);
 	hash_destroy(&cache->objects);
-	pool_unref(cache->right_names_pool);
+	pool_unref(&cache->right_names_pool);
 	i_free(cache);
 }
 
--- a/src/plugins/expire/expire-env.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/plugins/expire/expire-env.c	Sun Sep 16 14:04:06 2007 +0300
@@ -43,7 +43,7 @@
 
 void expire_env_deinit(struct expire_env *env)
 {
-	pool_unref(env->pool);
+	pool_unref(&env->pool);
 }
 
 const struct expire_box *expire_box_find(struct expire_env *env,
--- a/src/plugins/fts-squat/squat-uidlist.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/plugins/fts-squat/squat-uidlist.c	Sun Sep 16 14:04:06 2007 +0300
@@ -293,7 +293,7 @@
 {
 	squat_uidlist_close(uidlist);
 
-	pool_unref(uidlist->node_pool);
+	pool_unref(&uidlist->node_pool);
 	array_free(&uidlist->lists);
 	buffer_free(&uidlist->tmp_buf);
 	buffer_free(&uidlist->list_buf);
@@ -925,7 +925,7 @@
 	*_ctx = NULL;
 
 	if (ctx->node_pool != NULL)
-		pool_unref(ctx->node_pool);
+		pool_unref(&ctx->node_pool);
 	if (array_is_created(&ctx->seen_uids))
 		array_free(&ctx->seen_uids);
 	if (ctx->output != NULL) {
--- a/src/plugins/mail-log/mail-log-plugin.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/plugins/mail-log/mail-log-plugin.c	Sun Sep 16 14:04:06 2007 +0300
@@ -409,7 +409,7 @@
 	if (lt != NULL) {
 		if (lt->changes > 0 && mail_log_set.group_events)
 			mail_log_group_changes(t->box, lt);
-		pool_unref(lt->pool);
+		pool_unref(&lt->pool);
 	}
 
 	return lbox->super.transaction_commit(t, flags, uid_validity_r,
@@ -428,7 +428,7 @@
 			i_info("Transaction rolled back: "
 			       "Ignore last %u changes", lt->changes);
 		}
-		pool_unref(lt->pool);
+		pool_unref(&lt->pool);
 	}
 
 	lbox->super.transaction_rollback(t);
--- a/src/plugins/quota/quota.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/plugins/quota/quota.c	Sun Sep 16 14:04:06 2007 +0300
@@ -168,7 +168,7 @@
 	array_free(&root->quota_module_contexts);
 
 	root->backend.v.deinit(root);
-	pool_unref(pool);
+	pool_unref(&pool);
 }
 
 static struct quota_rule *
--- a/src/plugins/trash/trash-plugin.c	Sun Sep 16 13:51:51 2007 +0300
+++ b/src/plugins/trash/trash-plugin.c	Sun Sep 16 14:04:06 2007 +0300
@@ -319,5 +319,5 @@
 	quota_set->test_alloc = trash_next_quota_test_alloc;
 
 	if (config_pool != NULL)
-		pool_unref(config_pool);
+		pool_unref(&config_pool);
 }