diff options
author | Jeffrey Stedfast <fejj@novell.com> | 2004-08-14 02:13:02 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2004-08-14 02:13:02 +0800 |
commit | b851882164e75ce857f590e92f0dec0c03771311 (patch) | |
tree | 89444fce1241435f71f8f6b66b371c5b972d3158 | |
parent | 20618e52c5c7004ee3249368e70005c2f089d730 (diff) | |
download | gsoc2013-evolution-b851882164e75ce857f590e92f0dec0c03771311.tar gsoc2013-evolution-b851882164e75ce857f590e92f0dec0c03771311.tar.gz gsoc2013-evolution-b851882164e75ce857f590e92f0dec0c03771311.tar.bz2 gsoc2013-evolution-b851882164e75ce857f590e92f0dec0c03771311.tar.lz gsoc2013-evolution-b851882164e75ce857f590e92f0dec0c03771311.tar.xz gsoc2013-evolution-b851882164e75ce857f590e92f0dec0c03771311.tar.zst gsoc2013-evolution-b851882164e75ce857f590e92f0dec0c03771311.zip |
Use g_ptr_array_sized_new() rather than using set_size() after creating a
2004-08-13 Jeffrey Stedfast <fejj@novell.com>
* 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
-rw-r--r-- | camel/ChangeLog | 2 | ||||
-rw-r--r-- | 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 <snallagatla@novell.com> 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 |