[dovecot-cvs] dovecot/src/lib-index mail-index-private.h, 1.52,
1.53 mail-index-sync.c, 1.52, 1.53 mail-index-transaction.c,
1.56, 1.57 mail-index.c, 1.194, 1.195 mail-index.h, 1.144, 1.145
cras at dovecot.org
cras at dovecot.org
Sun Mar 27 15:22:24 EEST 2005
- Previous message: [dovecot-cvs] dovecot/src/lib-storage/index/mbox
mbox-sync-private.h, 1.43, 1.44 mbox-sync-rewrite.c, 1.41,
1.42 mbox-sync-update.c, 1.27, 1.28 mbox-sync.c, 1.139, 1.140
- Next message: [dovecot-cvs]
dovecot/src/lib data-stack.c, 1.22, 1.23 data-stack.h, 1.4, 1.5
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv16709
Modified Files:
mail-index-private.h mail-index-sync.c
mail-index-transaction.c mail-index.c mail-index.h
Log Message:
Changed keywords_buf to array. Added mail_index_sync_get_keywords().
Index: mail-index-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-private.h,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- mail-index-private.h 24 Mar 2005 22:12:12 -0000 1.52
+++ mail-index-private.h 27 Mar 2005 12:22:21 -0000 1.53
@@ -139,7 +139,7 @@
uoff_t sync_log_file_offset;
pool_t keywords_pool;
- buffer_t *keywords_buf;
+ array_t ARRAY_DEFINE(keywords_arr, const char *);
const char *const *keywords;
uint32_t keywords_ext_id;
Index: mail-index-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-sync.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- mail-index-sync.c 14 Mar 2005 20:48:25 -0000 1.52
+++ mail-index-sync.c 27 Mar 2005 12:22:21 -0000 1.53
@@ -624,6 +624,13 @@
mail_index_sync_end(ctx);
}
+const char *const *const *
+mail_index_sync_get_keywords(struct mail_index_sync_ctx *ctx)
+{
+ return &ctx->index->keywords;
+}
+
+
void mail_index_sync_flags_apply(const struct mail_index_sync_rec *sync_rec,
uint8_t *flags)
{
Index: mail-index-transaction.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-transaction.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- mail-index-transaction.c 24 Mar 2005 21:00:10 -0000 1.56
+++ mail-index-transaction.c 27 Mar 2005 12:22:21 -0000 1.57
@@ -835,7 +835,6 @@
struct mail_keywords *k;
const char **missing_keywords, *keyword;
unsigned int count, i, j, k_pos = 0, missing_count = 0;
- size_t size;
if (keywords == NULL) {
k = i_new(struct mail_keywords, 1);
@@ -868,21 +867,20 @@
if (missing_count > 0) {
/* add missing keywords. first drop the trailing NULL. */
- size = index->keywords_buf->used - sizeof(const char *);
- buffer_set_used_size(index->keywords_buf, size);
+ array_delete(&index->keywords_arr,
+ array_count(&index->keywords_arr) - 1, 1);
- j = size / sizeof(const char *);
+ j = array_count(&index->keywords_arr);
for (; *missing_keywords != NULL; missing_keywords++, j++) {
keyword = p_strdup(index->keywords_pool,
*missing_keywords);
- buffer_append(index->keywords_buf,
- &keyword, sizeof(keyword));
+ array_append(&index->keywords_arr, &keyword, 1);
k->idx[k_pos++] = j;
}
- buffer_append_zero(index->keywords_buf, sizeof(const char *));
- index->keywords = index->keywords_buf->data;
+ (void)array_modifyable_append(&index->keywords_arr);
+ index->keywords = array_idx(&index->keywords_arr, 0);
}
i_assert(k_pos == count);
Index: mail-index.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index.c,v
retrieving revision 1.194
retrieving revision 1.195
diff -u -d -r1.194 -r1.195
--- mail-index.c 24 Mar 2005 22:12:12 -0000 1.194
+++ mail-index.c 27 Mar 2005 12:22:21 -0000 1.195
@@ -43,9 +43,10 @@
index->keywords_ext_id =
mail_index_ext_register(index, "keywords", 128, 2, 1);
index->keywords_pool = pool_alloconly_create("keywords", 512);
- index->keywords_buf = buffer_create_dynamic(default_pool, 64);
- buffer_append_zero(index->keywords_buf, sizeof(const char *));
- index->keywords = index->keywords_buf->data;
+ ARRAY_CREATE(&index->keywords_arr, default_pool,
+ const char *, 16);
+ (void)array_modifyable_append(&index->keywords_arr);
+ index->keywords = array_idx(&index->keywords_arr, 0);
return index;
}
@@ -58,7 +59,7 @@
array_free(&index->sync_handlers);
array_free(&index->sync_lost_handlers);
array_free(&index->expunge_handlers);
- buffer_free(index->keywords_buf);
+ array_free(&index->keywords_arr);
i_free(index->error);
i_free(index->dir);
Index: mail-index.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index.h,v
retrieving revision 1.144
retrieving revision 1.145
diff -u -d -r1.144 -r1.145
--- mail-index.h 14 Mar 2005 20:48:25 -0000 1.144
+++ mail-index.h 27 Mar 2005 12:22:21 -0000 1.145
@@ -291,7 +291,7 @@
enum modify_type modify_type,
enum mail_flags flags);
-/* Return a list of all existing keywords, or NULL if there is none. */
+/* Return a NULL-terminated list of all existing keywords. */
const char *const *mail_index_get_keywords(struct mail_index *index);
/* Create a keyword list structure. It's freed automatically at the end of
the transaction. */
@@ -317,6 +317,11 @@
/* Reset the error message. */
void mail_index_reset_error(struct mail_index *index);
+/* Return a pointer to NULL-terminated list of keywords which are referenced
+ in mail_index_sync_rec->keyword_idx. Note tat the pointer may change after
+ calling mail_index_keywords_create(). */
+const char *const *const *
+mail_index_sync_get_keywords(struct mail_index_sync_ctx *ctx);
/* Apply changes in MAIL_INDEX_SYNC_TYPE_FLAGS typed sync records to given
flags variables. */
void mail_index_sync_flags_apply(const struct mail_index_sync_rec *sync_rec,
- Previous message: [dovecot-cvs] dovecot/src/lib-storage/index/mbox
mbox-sync-private.h, 1.43, 1.44 mbox-sync-rewrite.c, 1.41,
1.42 mbox-sync-update.c, 1.27, 1.28 mbox-sync.c, 1.139, 1.140
- Next message: [dovecot-cvs]
dovecot/src/lib data-stack.c, 1.22, 1.23 data-stack.h, 1.4, 1.5
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list