diff options
author | Jeffrey Stedfast <fejj@novell.com> | 2004-07-01 03:55:29 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2004-07-01 03:55:29 +0800 |
commit | c9715f0a81f0dcb36d5266346facafd3f52511ec (patch) | |
tree | 97a7bc7876a04faaf744c02d4ebc53299a4b475e /camel/providers | |
parent | d08695416fbeb098fe9e3906a6d10ced297b6c40 (diff) | |
download | gsoc2013-evolution-c9715f0a81f0dcb36d5266346facafd3f52511ec.tar.gz gsoc2013-evolution-c9715f0a81f0dcb36d5266346facafd3f52511ec.tar.zst gsoc2013-evolution-c9715f0a81f0dcb36d5266346facafd3f52511ec.zip |
Set the size of the ptrarray to prevent potentially realloc'ing several
2004-06-30 Jeffrey Stedfast <fejj@novell.com>
* providers/imap4/camel-imap4-search.c (imap4_body_contains): Set
the size of the ptrarray to prevent potentially realloc'ing
several times.
svn path=/trunk/; revision=26555
Diffstat (limited to 'camel/providers')
-rw-r--r-- | camel/providers/imap4/camel-imap4-search.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/camel/providers/imap4/camel-imap4-search.c b/camel/providers/imap4/camel-imap4-search.c index 4a23dee83e..0a10ea5139 100644 --- a/camel/providers/imap4/camel-imap4-search.c +++ b/camel/providers/imap4/camel-imap4-search.c @@ -174,9 +174,11 @@ imap4_body_contains (struct _ESExp *f, int argc, struct _ESExpResult **argv, Cam } else { r = e_sexp_result_new (f, ESEXP_RES_ARRAY_PTR); r->value.ptrarray = g_ptr_array_new (); + g_ptr_array_set_size (r->value.ptrarray, summary_set->len); + r->value.ptrarray->len = summary_set->len; for (i = 0; i < summary_set->len; i++) { info = g_ptr_array_index (summary_set, i); - g_ptr_array_add (r->value.ptrarray, (char *) camel_message_info_uid (info)); + r->value.ptrarray->pdata[i] = (char *) camel_message_info_uid (info); } } @@ -211,9 +213,11 @@ imap4_body_contains (struct _ESExp *f, int argc, struct _ESExpResult **argv, Cam } else { r = e_sexp_result_new (f, ESEXP_RES_ARRAY_PTR); r->value.ptrarray = g_ptr_array_new (); + g_ptr_array_set_size (r->value.ptrarray, summary_set->len); + r->value.ptrarray->len = summary_set->len; for (i = 0; i < summary_set->len; i++) { info = g_ptr_array_index (summary_set, i); - g_ptr_array_add (r->value.ptrarray, (char *) camel_message_info_uid (info)); + r->value.ptrarray->pdata[i] = (char *) camel_message_info_uid (info); } } @@ -227,10 +231,10 @@ imap4_body_contains (struct _ESExp *f, int argc, struct _ESExpResult **argv, Cam if (search->current) { g_ptr_array_add (infos, search->current); } else { - for (i = 0; i < summary_set->len; i++) { - info = g_ptr_array_index (summary_set, i); - g_ptr_array_add (infos, info); - } + g_ptr_array_set_size (infos, summary_set->len); + infos->len = summary_set->len; + for (i = 0; i < summary_set->len; i++) + infos->pdata[i] = summary_set->pdata[i]; } retry: |