dovecot-1.2: imap: Code cleanup: Changed buffer to an array.
dovecot at dovecot.org
dovecot at dovecot.org
Wed Mar 11 22:11:59 EET 2009
details: http://hg.dovecot.org/dovecot-1.2/rev/6431b25959c4
changeset: 8813:6431b25959c4
user: Timo Sirainen <tss at iki.fi>
date: Wed Mar 11 16:11:55 2009 -0400
description:
imap: Code cleanup: Changed buffer to an array.
diffstat:
3 files changed, 8 insertions(+), 9 deletions(-)
src/imap/imap-fetch-body.c | 4 ++--
src/imap/imap-fetch.c | 11 +++++------
src/imap/imap-fetch.h | 2 +-
diffs (63 lines):
diff -r 69a5c4798421 -r 6431b25959c4 src/imap/imap-fetch-body.c
--- a/src/imap/imap-fetch-body.c Wed Mar 11 16:04:01 2009 -0400
+++ b/src/imap/imap-fetch-body.c Wed Mar 11 16:11:55 2009 -0400
@@ -655,8 +655,8 @@ static bool fetch_body_header_fields_ini
}
for (arr = body->fields; *arr != NULL; arr++) {
- char *hdr = p_strdup(ctx->cmd->pool, *arr);
- buffer_append(ctx->all_headers_buf, &hdr, sizeof(hdr));
+ const char *hdr = p_strdup(ctx->cmd->pool, *arr);
+ array_append(&ctx->all_headers, &hdr, 1);
}
body->header_ctx = mailbox_header_lookup_init(ctx->box, body->fields);
diff -r 69a5c4798421 -r 6431b25959c4 src/imap/imap-fetch.c
--- a/src/imap/imap-fetch.c Wed Mar 11 16:04:01 2009 -0400
+++ b/src/imap/imap-fetch.c Wed Mar 11 16:11:55 2009 -0400
@@ -102,7 +102,7 @@ imap_fetch_init(struct client_command_co
ctx->box = box;
ctx->cur_str = str_new(default_pool, 8192);
- ctx->all_headers_buf = buffer_create_dynamic(cmd->pool, 128);
+ p_array_init(&ctx->all_headers, cmd->pool, 64);
p_array_init(&ctx->handlers, cmd->pool, 16);
p_array_init(&ctx->tmp_keywords, cmd->pool,
client->keywords.announce_count + 8);
@@ -314,7 +314,6 @@ imap_fetch_send_vanished(struct imap_fet
int imap_fetch_begin(struct imap_fetch_context *ctx)
{
- const void *null = NULL;
const void *data;
if (ctx->send_vanished) {
@@ -333,12 +332,12 @@ int imap_fetch_begin(struct imap_fetch_c
}
}
- if (buffer_get_used_size(ctx->all_headers_buf) != 0 &&
+ if (array_count(&ctx->all_headers) > 0 &&
((ctx->fetch_data & (MAIL_FETCH_STREAM_HEADER |
MAIL_FETCH_STREAM_BODY)) == 0)) {
- buffer_append(ctx->all_headers_buf, &null, sizeof(null));
-
- data = buffer_get_data(ctx->all_headers_buf, NULL);
+ (void)array_append_space(&ctx->all_headers);
+
+ data = array_idx(&ctx->all_headers, 0);
ctx->all_headers_ctx =
mailbox_header_lookup_init(ctx->box, data);
}
diff -r 69a5c4798421 -r 6431b25959c4 src/imap/imap-fetch.h
--- a/src/imap/imap-fetch.h Wed Mar 11 16:04:01 2009 -0400
+++ b/src/imap/imap-fetch.h Wed Mar 11 16:11:55 2009 -0400
@@ -38,7 +38,7 @@ struct imap_fetch_context {
struct mail *mail;
enum mail_fetch_field fetch_data;
- buffer_t *all_headers_buf;
+ ARRAY_TYPE(const_string) all_headers;
struct mailbox_header_lookup_ctx *all_headers_ctx;
ARRAY_DEFINE(handlers, struct imap_fetch_context_handler);
More information about the dovecot-cvs
mailing list