aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/importers
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2003-06-03 03:13:45 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2003-06-03 03:13:45 +0800
commit6da0fcbfd6c08cbcfe53c5b0d4524046c9eaf03c (patch)
treeafe698ef2a37ae6afbdc1587b33ec2a7dc1390e4 /calendar/importers
parent941e8c0931dae4df4706994577c895414ae3d538 (diff)
downloadgsoc2013-evolution-6da0fcbfd6c08cbcfe53c5b0d4524046c9eaf03c.tar
gsoc2013-evolution-6da0fcbfd6c08cbcfe53c5b0d4524046c9eaf03c.tar.gz
gsoc2013-evolution-6da0fcbfd6c08cbcfe53c5b0d4524046c9eaf03c.tar.bz2
gsoc2013-evolution-6da0fcbfd6c08cbcfe53c5b0d4524046c9eaf03c.tar.lz
gsoc2013-evolution-6da0fcbfd6c08cbcfe53c5b0d4524046c9eaf03c.tar.xz
gsoc2013-evolution-6da0fcbfd6c08cbcfe53c5b0d4524046c9eaf03c.tar.zst
gsoc2013-evolution-6da0fcbfd6c08cbcfe53c5b0d4524046c9eaf03c.zip
Fixes part of #43388
2003-06-02 Rodrigo Moya <rodrigo@ximian.com> Fixes part of #43388 * importers/icalendar-importer.c (prepare_events): (prepare_tasks): use external iterators for removing components from the main component. svn path=/trunk/; revision=21373
Diffstat (limited to 'calendar/importers')
-rw-r--r--calendar/importers/icalendar-importer.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/calendar/importers/icalendar-importer.c b/calendar/importers/icalendar-importer.c
index 59d529732d..28068c11df 100644
--- a/calendar/importers/icalendar-importer.c
+++ b/calendar/importers/icalendar-importer.c
@@ -127,25 +127,24 @@ read_file (const char *filename)
static GList*
prepare_events (icalcomponent *icalcomp)
{
- icalcomponent *subcomp, *next_subcomp;
+ icalcomponent *subcomp;
GList *vtodos = NULL;
+ icalcompiter iter;
- subcomp = icalcomponent_get_first_component (icalcomp,
- ICAL_ANY_COMPONENT);
- while (subcomp) {
+ iter = icalcomponent_begin_component (icalcomp, ICAL_ANY_COMPONENT);
+ while ((subcomp = icalcompiter_deref (&iter)) != NULL) {
icalcomponent_kind child_kind = icalcomponent_isa (subcomp);
- next_subcomp = icalcomponent_get_next_component (icalcomp, ICAL_ANY_COMPONENT);
if (child_kind != ICAL_VEVENT_COMPONENT
&& child_kind != ICAL_VTIMEZONE_COMPONENT) {
- icalcomponent_remove_component (icalcomp,
- subcomp);
+ icalcomponent_remove_component (icalcomp, subcomp);
if (child_kind == ICAL_VTODO_COMPONENT)
vtodos = g_list_prepend (vtodos, subcomp);
else
icalcomponent_free (subcomp);
}
- subcomp = next_subcomp;
+
+ icalcompiter_next (&iter);
}
return vtodos;
@@ -158,20 +157,20 @@ prepare_events (icalcomponent *icalcomp)
static void
prepare_tasks (icalcomponent *icalcomp, GList *vtodos)
{
- icalcomponent *subcomp, *next_subcomp;
+ icalcomponent *subcomp;
GList *elem;
+ icalcompiter iter;
- subcomp = icalcomponent_get_first_component (icalcomp,
- ICAL_ANY_COMPONENT);
- while (subcomp) {
+ iter = icalcomponent_begin_component (icalcomp, ICAL_ANY_COMPONENT);
+ while ((subcomp = icalcompiter_deref (&iter)) != NULL) {
icalcomponent_kind child_kind = icalcomponent_isa (subcomp);
- next_subcomp = icalcomponent_get_next_component (icalcomp, ICAL_ANY_COMPONENT);
if (child_kind != ICAL_VTODO_COMPONENT
&& child_kind != ICAL_VTIMEZONE_COMPONENT) {
icalcomponent_remove_component (icalcomp, subcomp);
icalcomponent_free (subcomp);
}
- subcomp = next_subcomp;
+
+ icalcompiter_next (&iter);
}
for (elem = vtodos; elem; elem = elem->next) {