From b851882164e75ce857f590e92f0dec0c03771311 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Fri, 13 Aug 2004 18:13:02 +0000 Subject: Use g_ptr_array_sized_new() rather than using set_size() after creating a 2004-08-13 Jeffrey Stedfast * providers/imap4/camel-imap4-summary.c (imap4_summary_fetch_all): Use g_ptr_array_sized_new() rather than using set_size() after creating a GPtrArray so that array->len starts out at 0. (imap4_summary_fetch_flags): Same. svn path=/trunk/; revision=26923 --- camel/ChangeLog | 2 +- camel/providers/imap4/camel-imap4-summary.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/camel/ChangeLog b/camel/ChangeLog index 63984d144c..467bdb2e67 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -11,7 +11,7 @@ remove the cal/taksks sources when account is disbaled. Also do not try to to create sources when a disabled account is changed to Novell Groupwise - (camel_gw_listener_construct) : do not add the disbaled accounts + (camel_gw_listener_construct): do not add the disbaled accounts to exitsting groupwise accounts list 2004-08-13 Sivaiah Nallagatla diff --git a/camel/providers/imap4/camel-imap4-summary.c b/camel/providers/imap4/camel-imap4-summary.c index fec70c2b12..27b13d9099 100644 --- a/camel/providers/imap4/camel-imap4-summary.c +++ b/camel/providers/imap4/camel-imap4-summary.c @@ -922,6 +922,7 @@ imap4_summary_fetch_all (CamelFolderSummary *summary, guint32 first, guint32 las struct imap4_fetch_all_t *fetch; CamelIMAP4Engine *engine; CamelIMAP4Command *ic; + int total; engine = ((CamelIMAP4Store *) folder->parent_store)->engine; @@ -929,18 +930,17 @@ imap4_summary_fetch_all (CamelFolderSummary *summary, guint32 first, guint32 las * 'added' array here rather than possibly having to grow it * one element at a time (in the common case) in the * untagged_fetch_all() callback */ + total = last ? (last - first) + 1 : (imap4_summary->exists - first) + 1; fetch = g_new (struct imap4_fetch_all_t, 1); fetch->uid_hash = g_hash_table_new (g_str_hash, g_str_equal); fetch->changes = camel_folder_change_info_new (); - fetch->added = g_ptr_array_new (); + fetch->added = g_ptr_array_sized_new (total); fetch->summary = summary; fetch->first = first; fetch->need = IMAP4_FETCH_ALL; - fetch->total = last ? (last - first) + 1 : (imap4_summary->exists - first) + 1; + fetch->total = total; fetch->count = 0; - g_ptr_array_set_size (fetch->added, fetch->total); - /* From rfc2060, Section 6.4.5: * * The currently defined data items that can be fetched are: @@ -968,6 +968,7 @@ imap4_summary_fetch_flags (CamelFolderSummary *summary, guint32 first, guint32 l struct imap4_fetch_all_t *fetch; CamelIMAP4Engine *engine; CamelIMAP4Command *ic; + int total; engine = ((CamelIMAP4Store *) folder->parent_store)->engine; @@ -975,18 +976,17 @@ imap4_summary_fetch_flags (CamelFolderSummary *summary, guint32 first, guint32 l * 'added' array here rather than possibly having to grow it * one element at a time (in the common case) in the * untagged_fetch_all() callback */ + total = (last - first) + 1; fetch = g_new (struct imap4_fetch_all_t, 1); fetch->uid_hash = g_hash_table_new (g_str_hash, g_str_equal); fetch->changes = camel_folder_change_info_new (); - fetch->added = g_ptr_array_new (); + fetch->added = g_ptr_array_sized_new (total); fetch->summary = summary; fetch->first = first; fetch->need = IMAP4_FETCH_UID | IMAP4_FETCH_FLAGS; - fetch->total = (last - first) + 1; + fetch->total = total; fetch->count = 0; - g_ptr_array_set_size (fetch->added, fetch->total); - if (last != 0) ic = camel_imap4_engine_queue (engine, folder, "FETCH %u:%u (UID FLAGS)\r\n", first, last); else -- cgit v1.2.3