[dovecot-cvs] dovecot/src/plugins/fts-squat squat-uidlist.c, 1.9, 1.10
tss at dovecot.org
tss at dovecot.org
Wed Dec 20 14:45:42 UTC 2006
Update of /var/lib/cvs/dovecot/src/plugins/fts-squat
In directory talvi:/tmp/cvs-serv21160
Modified Files:
squat-uidlist.c
Log Message:
Use seq_range_array_remove_range() instead of slowly iterating ourself.
Index: squat-uidlist.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/fts-squat/squat-uidlist.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- squat-uidlist.c 20 Dec 2006 13:59:16 -0000 1.9
+++ squat-uidlist.c 20 Dec 2006 14:45:39 -0000 1.10
@@ -45,7 +45,7 @@
ARRAY_TYPE(seq_range) *result;
- uint32_t filter_pos;
+ uint32_t filter_uid_pos;
};
struct squat_uidlist {
@@ -976,14 +976,16 @@
static void
squat_uidlist_get_add_uid(struct squat_uidlist_get_context *ctx, uint32_t uid)
{
- if (ctx->filter_pos == 0) {
+ if (ctx->filter_uid_pos == 0) {
seq_range_array_add(ctx->result, 0, uid);
return;
}
- for (; ctx->filter_pos < uid; ctx->filter_pos++)
- seq_range_array_remove(ctx->result, ctx->filter_pos);
- ctx->filter_pos++;
+ if (ctx->filter_uid_pos < uid) {
+ seq_range_array_remove_range(ctx->result,
+ ctx->filter_uid_pos, uid-1);
+ }
+ ctx->filter_uid_pos = uid+1;
}
static int
@@ -1053,15 +1055,15 @@
memset(&ctx, 0, sizeof(ctx));
ctx.uidlist = uidlist;
ctx.result = result;
- ctx.filter_pos = 1;
+ ctx.filter_uid_pos = 1;
if (squat_uidlist_get_ctx(&ctx, uid_list_idx) < 0)
return -1;
range = array_get(ctx.result, &count);
if (count > 0) {
- for (; ctx.filter_pos <= range[count-1].seq2; ctx.filter_pos++)
- seq_range_array_remove(result, ctx.filter_pos);
+ seq_range_array_remove_range(result, ctx.filter_uid_pos,
+ range[count-1].seq2);
}
return 0;
}
More information about the dovecot-cvs
mailing list