dovecot: Removed memory pool parameter from iostreams. Default p...

dovecot at dovecot.org dovecot at dovecot.org
Tue Jul 24 07:03:26 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/6c0bfc35af03
changeset: 6142:6c0bfc35af03
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Jul 24 06:59:56 2007 +0300
description:
Removed memory pool parameter from iostreams. Default pool was almost always
used, and the stream usually required destroying anyway so it didn't even
make freeing memory easier.

diffstat:

78 files changed, 205 insertions(+), 284 deletions(-)
src/auth/auth-client-connection.c                |    5 +---
src/auth/auth-master-connection.c                |    6 +----
src/auth/auth-worker-client.c                    |    5 +---
src/auth/auth-worker-server.c                    |    7 ++----
src/auth/db-passwd-file.c                        |    2 -
src/deliver/auth-client.c                        |    6 +----
src/deliver/deliver.c                            |   12 ++++------
src/deliver/duplicate.c                          |    4 +--
src/dict/dict-server.c                           |    6 ++---
src/imap-login/client.c                          |    6 +----
src/imap/client.c                                |    7 ++----
src/imap/cmd-append.c                            |    4 +--
src/imap/imap-fetch-body.c                       |    2 -
src/lib-auth/auth-server-connection.c            |    7 ++----
src/lib-dict/dict-client.c                       |    6 +----
src/lib-dict/dict-sql.c                          |    2 -
src/lib-imap/imap-bodystructure.c                |    3 --
src/lib-imap/imap-envelope.c                     |    3 --
src/lib-index/mail-cache-compress.c              |    2 -
src/lib-index/mailbox-list-index-sync.c          |    3 --
src/lib-mail/istream-header-filter.c             |   16 ++++++--------
src/lib-settings/settings.c                      |    2 -
src/lib-storage/index/cydir/cydir-mail.c         |    3 --
src/lib-storage/index/cydir/cydir-save.c         |    4 +--
src/lib-storage/index/dbox/dbox-file.c           |    3 --
src/lib-storage/index/dbox/dbox-mail.c           |    3 --
src/lib-storage/index/dbox/dbox-sync-expunge.c   |    4 +--
src/lib-storage/index/dbox/dbox-uidlist.c        |   13 +++++------
src/lib-storage/index/index-mail-headers.c       |    9 +++----
src/lib-storage/index/maildir/maildir-keywords.c |    2 -
src/lib-storage/index/maildir/maildir-mail.c     |    3 --
src/lib-storage/index/maildir/maildir-save.c     |    5 +---
src/lib-storage/index/maildir/maildir-uidlist.c  |    4 +--
src/lib-storage/index/mbox/istream-raw-mbox.c    |    6 ++---
src/lib-storage/index/mbox/istream-raw-mbox.h    |    2 -
src/lib-storage/index/mbox/mbox-file.c           |   15 +++++--------
src/lib-storage/index/mbox/mbox-mail.c           |    2 -
src/lib-storage/index/mbox/mbox-save.c           |    7 ++----
src/lib-storage/index/mbox/mbox-sync-rewrite.c   |    6 +----
src/lib-storage/list/subscription-file.c         |   16 ++++++--------
src/lib/file-copy.c                              |    4 +--
src/lib/iostream-internal.h                      |    3 --
src/lib/iostream.c                               |   10 +-------
src/lib/istream-data.c                           |    7 ++----
src/lib/istream-file.c                           |   10 ++++----
src/lib/istream-internal.h                       |    4 +--
src/lib/istream-limit.c                          |    6 ++---
src/lib/istream-mmap.c                           |    6 ++---
src/lib/istream-seekable.c                       |   23 +++++++-------------
src/lib/istream-seekable.h                       |    2 -
src/lib/istream-tee.c                            |   15 +++++--------
src/lib/istream-tee.h                            |    5 +---
src/lib/istream.c                                |   25 ++++++++--------------
src/lib/istream.h                                |   11 ++++-----
src/lib/ostream-crlf.c                           |   23 +++++++++-----------
src/lib/ostream-crlf.h                           |    4 +--
src/lib/ostream-file.c                           |   16 +++++---------
src/lib/ostream-internal.h                       |    2 -
src/lib/ostream.c                                |    4 +--
src/lib/ostream.h                                |    3 --
src/login-common/login-proxy.c                   |    7 ++----
src/login-common/master.c                        |    2 -
src/master/auth-process.c                        |    6 +----
src/master/log.c                                 |    2 -
src/master/login-process.c                       |    2 -
src/plugins/acl/acl-backend-vfile-acllist.c      |    4 +--
src/plugins/acl/acl-backend-vfile.c              |    2 -
src/plugins/expire/auth-client.c                 |    6 +----
src/plugins/fts-squat/squat-test.c               |    2 -
src/plugins/fts-squat/squat-trie.c               |    4 +--
src/plugins/fts-squat/squat-uidlist.c            |    5 +---
src/plugins/trash/trash-plugin.c                 |    2 -
src/plugins/zlib/istream-zlib.c                  |   10 ++++----
src/plugins/zlib/istream-zlib.h                  |    2 -
src/plugins/zlib/zlib-plugin.c                   |    6 +----
src/pop3-login/client.c                          |    6 +----
src/pop3/client.c                                |    6 +----
src/util/rawlog.c                                |    9 ++-----

diffs (truncated from 1698 to 300 lines):

diff -r 783d614b0db4 -r 6c0bfc35af03 src/auth/auth-client-connection.c
--- a/src/auth/auth-client-connection.c	Tue Jul 24 06:49:00 2007 +0300
+++ b/src/auth/auth-client-connection.c	Tue Jul 24 06:59:56 2007 +0300
@@ -275,10 +275,9 @@ auth_client_connection_create(struct aut
 
 	conn->fd = fd;
 	conn->input =
-		i_stream_create_file(fd, default_pool,
-				     AUTH_CLIENT_MAX_LINE_LENGTH, FALSE);
+		i_stream_create_file(fd, AUTH_CLIENT_MAX_LINE_LENGTH, FALSE);
 	conn->output =
-		o_stream_create_file(fd, default_pool, (size_t)-1, FALSE);
+		o_stream_create_file(fd, (size_t)-1, FALSE);
 	o_stream_set_flush_callback(conn->output, auth_client_output, conn);
 	conn->io = io_add(fd, IO_READ, auth_client_input, conn);
 
diff -r 783d614b0db4 -r 6c0bfc35af03 src/auth/auth-master-connection.c
--- a/src/auth/auth-master-connection.c	Tue Jul 24 06:49:00 2007 +0300
+++ b/src/auth/auth-master-connection.c	Tue Jul 24 06:59:56 2007 +0300
@@ -242,10 +242,8 @@ auth_master_connection_create(struct aut
 	conn->listener = listener;
 	conn->refcount = 1;
 	conn->fd = fd;
-	conn->input = i_stream_create_file(fd, default_pool,
-					   MAX_INBUF_SIZE, FALSE);
-	conn->output = o_stream_create_file(fd, default_pool,
-					    (size_t)-1, FALSE);
+	conn->input = i_stream_create_file(fd, MAX_INBUF_SIZE, FALSE);
+	conn->output = o_stream_create_file(fd, (size_t)-1, FALSE);
 	o_stream_set_flush_callback(conn->output, master_output, conn);
 	conn->io = io_add(fd, IO_READ, master_input, conn);
 
diff -r 783d614b0db4 -r 6c0bfc35af03 src/auth/auth-worker-client.c
--- a/src/auth/auth-worker-client.c	Tue Jul 24 06:49:00 2007 +0300
+++ b/src/auth/auth-worker-client.c	Tue Jul 24 06:59:56 2007 +0300
@@ -468,10 +468,9 @@ auth_worker_client_create(struct auth *a
 	client->auth = auth;
 	client->fd = fd;
 	client->input =
-		i_stream_create_file(fd, default_pool,
-				     AUTH_WORKER_MAX_LINE_LENGTH, FALSE);
+		i_stream_create_file(fd, AUTH_WORKER_MAX_LINE_LENGTH, FALSE);
 	client->output =
-		o_stream_create_file(fd, default_pool, (size_t)-1, FALSE);
+		o_stream_create_file(fd, (size_t)-1, FALSE);
 	o_stream_set_flush_callback(client->output, auth_worker_output, client);
 	client->io = io_add(fd, IO_READ, auth_worker_input, client);
 
diff -r 783d614b0db4 -r 6c0bfc35af03 src/auth/auth-worker-server.c
--- a/src/auth/auth-worker-server.c	Tue Jul 24 06:49:00 2007 +0300
+++ b/src/auth/auth-worker-server.c	Tue Jul 24 06:59:56 2007 +0300
@@ -79,10 +79,9 @@ static struct auth_worker_connection *au
 
 	conn = i_new(struct auth_worker_connection, 1);
 	conn->fd = fd;
-	conn->input = i_stream_create_file(fd, default_pool,
-					   AUTH_WORKER_MAX_LINE_LENGTH, FALSE);
-	conn->output =
-		o_stream_create_file(fd, default_pool, (size_t)-1, FALSE);
+	conn->input = i_stream_create_file(fd, AUTH_WORKER_MAX_LINE_LENGTH,
+					   FALSE);
+	conn->output = o_stream_create_file(fd, (size_t)-1, FALSE);
 	conn->io = io_add(fd, IO_READ, worker_input, conn);
 	conn->requests = buffer_create_dynamic(default_pool, 128);
 
diff -r 783d614b0db4 -r 6c0bfc35af03 src/auth/db-passwd-file.c
--- a/src/auth/db-passwd-file.c	Tue Jul 24 06:49:00 2007 +0300
+++ b/src/auth/db-passwd-file.c	Tue Jul 24 06:59:56 2007 +0300
@@ -183,7 +183,7 @@ static bool passwd_file_open(struct pass
 	pw->users = hash_create(default_pool, pw->pool, 100,
 				str_hash, (hash_cmp_callback_t *)strcmp);
 
-	input = i_stream_create_file(pw->fd, default_pool, 4096, FALSE);
+	input = i_stream_create_file(pw->fd, 4096, FALSE);
 	while ((line = i_stream_read_next_line(input)) != NULL) {
 		if (*line == '\0' || *line == ':' || *line == '#')
 			continue; /* no username or comment */
diff -r 783d614b0db4 -r 6c0bfc35af03 src/deliver/auth-client.c
--- a/src/deliver/auth-client.c	Tue Jul 24 06:49:00 2007 +0300
+++ b/src/deliver/auth-client.c	Tue Jul 24 06:59:56 2007 +0300
@@ -179,10 +179,8 @@ static struct auth_connection *auth_conn
 
 	conn = i_new(struct auth_connection, 1);
 	conn->fd = fd;
-	conn->input =
-		i_stream_create_file(fd, default_pool, MAX_INBUF_SIZE, FALSE);
-	conn->output =
-		o_stream_create_file(fd, default_pool, MAX_OUTBUF_SIZE, FALSE);
+	conn->input = i_stream_create_file(fd, MAX_INBUF_SIZE, FALSE);
+	conn->output = o_stream_create_file(fd, MAX_OUTBUF_SIZE, FALSE);
 	conn->io = io_add(fd, IO_READ, auth_input, conn);
 	return conn;
 }
diff -r 783d614b0db4 -r 6c0bfc35af03 src/deliver/deliver.c
--- a/src/deliver/deliver.c	Tue Jul 24 06:49:00 2007 +0300
+++ b/src/deliver/deliver.c	Tue Jul 24 06:59:56 2007 +0300
@@ -229,7 +229,7 @@ static void config_file_init(const char 
 		i_fatal_status(EX_CONFIG, "open(%s) failed: %m", path);
 
 	t_push();
-	input = i_stream_create_file(fd, default_pool, 1024, TRUE);
+	input = i_stream_create_file(fd, 1024, TRUE);
 	while ((line = i_stream_read_next_line(input)) != NULL) {
 		/* @UNSAFE: line is modified */
 
@@ -417,7 +417,7 @@ static struct istream *create_mbox_strea
 	envelope_sender = address_sanitize(envelope_sender);
 	mbox_hdr = mbox_from_create(envelope_sender, ioloop_time);
 
-	input = i_stream_create_file(fd, default_pool, 4096, FALSE);
+	input = i_stream_create_file(fd, 4096, FALSE);
 	input_filter =
 		i_stream_create_header_filter(input,
 					      HEADER_FILTER_EXCLUDE |
@@ -428,14 +428,12 @@ static struct istream *create_mbox_strea
 					      NULL);
 	i_stream_unref(&input);
 
-	input_list[0] = i_stream_create_from_data(default_pool, mbox_hdr,
-						  strlen(mbox_hdr));
+	input_list[0] = i_stream_create_from_data(mbox_hdr, strlen(mbox_hdr));
 	input_list[1] = input_filter;
-	input_list[2] = i_stream_create_from_data(default_pool, "\n", 1);
+	input_list[2] = i_stream_create_from_data("\n", 1);
 	input_list[3] = NULL;
 
-	input = i_stream_create_seekable(input_list, default_pool,
-					 MAIL_MAX_MEMORY_BUFFER,
+	input = i_stream_create_seekable(input_list, MAIL_MAX_MEMORY_BUFFER,
 					 "/tmp/dovecot.deliver.");
 	i_stream_unref(&input_list[0]);
 	i_stream_unref(&input_list[1]);
diff -r 783d614b0db4 -r 6c0bfc35af03 src/deliver/duplicate.c
--- a/src/deliver/duplicate.c	Tue Jul 24 06:49:00 2007 +0300
+++ b/src/deliver/duplicate.c	Tue Jul 24 06:59:56 2007 +0300
@@ -94,7 +94,7 @@ static int duplicate_read(struct duplica
 	}
 
 	/* <timestamp> <id_size> <user_size> <id> <user> */
-	input = i_stream_create_file(fd, default_pool, 4096, FALSE);
+	input = i_stream_create_file(fd, 4096, FALSE);
 
 	change_count = 0;
 	while (i_stream_read_data(input, &data, &size, sizeof(stamp) +
@@ -218,7 +218,7 @@ void duplicate_flush(void)
 	if (duplicate_file == NULL || !file->changed || file->new_fd == -1)
 		return;
 
-	output = o_stream_create_file(file->new_fd, default_pool, 4096, FALSE);
+	output = o_stream_create_file(file->new_fd, 4096, FALSE);
 	iter = hash_iterate_init(file->hash);
 	while (hash_iterate(iter, &key, &value)) {
 		struct duplicate *d = value;
diff -r 783d614b0db4 -r 6c0bfc35af03 src/dict/dict-server.c
--- a/src/dict/dict-server.c	Tue Jul 24 06:49:00 2007 +0300
+++ b/src/dict/dict-server.c	Tue Jul 24 06:59:56 2007 +0300
@@ -446,9 +446,9 @@ dict_client_connection_init(struct dict_
 	conn = i_new(struct dict_client_connection, 1);
 	conn->server = server;
 	conn->fd = fd;
-	conn->input = i_stream_create_file(fd, default_pool,
-					   DICT_CLIENT_MAX_LINE_LENGTH, FALSE);
-	conn->output = o_stream_create_file(fd, default_pool, 128*1024, FALSE);
+	conn->input = i_stream_create_file(fd, DICT_CLIENT_MAX_LINE_LENGTH,
+					   FALSE);
+	conn->output = o_stream_create_file(fd, 128*1024, FALSE);
 	conn->io = io_add(fd, IO_READ, dict_client_connection_input, conn);
 	return conn;
 }
diff -r 783d614b0db4 -r 6c0bfc35af03 src/imap-login/client.c
--- a/src/imap-login/client.c	Tue Jul 24 06:49:00 2007 +0300
+++ b/src/imap-login/client.c	Tue Jul 24 06:59:56 2007 +0300
@@ -68,10 +68,8 @@ static void client_set_title(struct imap
 
 static void client_open_streams(struct imap_client *client, int fd)
 {
-	client->input = i_stream_create_file(fd, default_pool,
-					     MAX_INBUF_SIZE, FALSE);
-	client->output = o_stream_create_file(fd, default_pool, MAX_OUTBUF_SIZE,
-					      FALSE);
+	client->input = i_stream_create_file(fd, MAX_INBUF_SIZE, FALSE);
+	client->output = o_stream_create_file(fd, MAX_OUTBUF_SIZE, FALSE);
 	client->parser = imap_parser_create(client->input, client->output,
 					    MAX_IMAP_LINE);
 }
diff -r 783d614b0db4 -r 6c0bfc35af03 src/imap/client.c
--- a/src/imap/client.c	Tue Jul 24 06:49:00 2007 +0300
+++ b/src/imap/client.c	Tue Jul 24 06:59:56 2007 +0300
@@ -30,10 +30,9 @@ struct client *client_create(int fd_in, 
 	client = i_new(struct client, 1);
 	client->fd_in = fd_in;
 	client->fd_out = fd_out;
-	client->input = i_stream_create_file(fd_in, default_pool,
-					     imap_max_line_length, FALSE);
-	client->output = o_stream_create_file(fd_out, default_pool,
-					      (size_t)-1, FALSE);
+	client->input =
+		i_stream_create_file(fd_in, imap_max_line_length, FALSE);
+	client->output = o_stream_create_file(fd_out, (size_t)-1, FALSE);
 
 	o_stream_set_flush_callback(client->output, _client_output, client);
 
diff -r 783d614b0db4 -r 6c0bfc35af03 src/imap/cmd-append.c
--- a/src/imap/cmd-append.c	Tue Jul 24 06:49:00 2007 +0300
+++ b/src/imap/cmd-append.c	Tue Jul 24 06:59:56 2007 +0300
@@ -186,7 +186,7 @@ static bool cmd_append_cancel(struct cmd
 
 	/* we have to read the nonsynced literal so we don't treat the message
 	   data as commands. */
-	ctx->input = i_stream_create_limit(default_pool, ctx->client->input,
+	ctx->input = i_stream_create_limit(ctx->client->input,
 					   ctx->client->input->v_offset,
 					   ctx->msg_size);
 
@@ -317,7 +317,7 @@ static bool cmd_append_continue_parsing(
 	}
 
 	/* save the mail */
-	ctx->input = i_stream_create_limit(default_pool, client->input,
+	ctx->input = i_stream_create_limit(client->input,
 					   client->input->v_offset,
 					   ctx->msg_size);
 	ret = mailbox_save_init(ctx->t, flags, keywords,
diff -r 783d614b0db4 -r 6c0bfc35af03 src/imap/imap-fetch-body.c
--- a/src/imap/imap-fetch-body.c	Tue Jul 24 06:49:00 2007 +0300
+++ b/src/imap/imap-fetch-body.c	Tue Jul 24 06:59:56 2007 +0300
@@ -280,7 +280,7 @@ static int fetch_stream(struct imap_fetc
 	if (size->physical_size == size->virtual_size &&
 	    ctx->cur_mail->has_no_nuls) {
 		/* no need to kludge with CRs, we can use sendfile() */
-		input = i_stream_create_limit(default_pool, ctx->cur_input,
+		input = i_stream_create_limit(ctx->cur_input,
 					      ctx->cur_input->v_offset,
 					      ctx->cur_size);
 		i_stream_unref(&ctx->cur_input);
diff -r 783d614b0db4 -r 6c0bfc35af03 src/lib-auth/auth-server-connection.c
--- a/src/lib-auth/auth-server-connection.c	Tue Jul 24 06:49:00 2007 +0300
+++ b/src/lib-auth/auth-server-connection.c	Tue Jul 24 06:59:56 2007 +0300
@@ -226,10 +226,9 @@ auth_server_connection_new(struct auth_c
 	conn->path = p_strdup(pool, path);
 	conn->fd = fd;
 	conn->io = io_add(fd, IO_READ, auth_client_input, conn);
-	conn->input = i_stream_create_file(fd, default_pool,
-					   AUTH_CLIENT_MAX_LINE_LENGTH, FALSE);
-	conn->output = o_stream_create_file(fd, default_pool, (size_t)-1,
-					    FALSE);
+	conn->input = i_stream_create_file(fd, AUTH_CLIENT_MAX_LINE_LENGTH,
+					   FALSE);
+	conn->output = o_stream_create_file(fd, (size_t)-1, FALSE);
 	conn->requests = hash_create(default_pool, pool, 100, NULL, NULL);
 	conn->auth_mechs_buf = buffer_create_dynamic(default_pool, 256);
 
diff -r 783d614b0db4 -r 6c0bfc35af03 src/lib-dict/dict-client.c
--- a/src/lib-dict/dict-client.c	Tue Jul 24 06:49:00 2007 +0300
+++ b/src/lib-dict/dict-client.c	Tue Jul 24 06:59:56 2007 +0300
@@ -244,10 +244,8 @@ static int client_dict_connect(struct cl
 	/* Dictionary lookups are blocking */
 	net_set_nonblock(dict->fd, FALSE);
 
-	dict->input = i_stream_create_file(dict->fd, default_pool,
-					   (size_t)-1, FALSE);
-	dict->output = o_stream_create_file(dict->fd, default_pool,
-					    4096, FALSE);
+	dict->input = i_stream_create_file(dict->fd, (size_t)-1, FALSE);
+	dict->output = o_stream_create_file(dict->fd, 4096, FALSE);
 	dict->transaction_id_counter = 0;
 
 	t_push();
diff -r 783d614b0db4 -r 6c0bfc35af03 src/lib-dict/dict-sql.c
--- a/src/lib-dict/dict-sql.c	Tue Jul 24 06:49:00 2007 +0300
+++ b/src/lib-dict/dict-sql.c	Tue Jul 24 06:59:56 2007 +0300
@@ -48,7 +48,7 @@ static int sql_dict_read_config(struct s
 		return -1;
 	}
 
-	input = i_stream_create_file(fd, default_pool, (size_t)-1, FALSE);
+	input = i_stream_create_file(fd, (size_t)-1, FALSE);
 	while ((line = i_stream_read_next_line(input)) != NULL) {
 		while (*line == ' ') line++;
 		value = strchr(line, '=');
diff -r 783d614b0db4 -r 6c0bfc35af03 src/lib-imap/imap-bodystructure.c
--- a/src/lib-imap/imap-bodystructure.c	Tue Jul 24 06:49:00 2007 +0300
+++ b/src/lib-imap/imap-bodystructure.c	Tue Jul 24 06:59:56 2007 +0300
@@ -695,8 +695,7 @@ bool imap_body_parse_from_bodystructure(
 	const struct imap_arg *args;
 	int ret;
 
-	input = i_stream_create_from_data(pool_datastack_create(),
-					  bodystructure, strlen(bodystructure));
+	input = i_stream_create_from_data(bodystructure, strlen(bodystructure));
 	(void)i_stream_read(input);
 
 	parser = imap_parser_create(input, NULL, (size_t)-1);
diff -r 783d614b0db4 -r 6c0bfc35af03 src/lib-imap/imap-envelope.c
--- a/src/lib-imap/imap-envelope.c	Tue Jul 24 06:49:00 2007 +0300
+++ b/src/lib-imap/imap-envelope.c	Tue Jul 24 06:59:56 2007 +0300
@@ -380,8 +380,7 @@ bool imap_envelope_parse(const char *env
 
 	i_assert(field < IMAP_ENVELOPE_FIELDS);
 


More information about the dovecot-cvs mailing list