aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog8
-rw-r--r--calendar/importers/icalendar-importer.c27
2 files changed, 21 insertions, 14 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 9c13f9f665..912411acd1 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,11 @@
+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.
+
2003-05-29 Rodrigo Moya <rodrigo@ximian.com>
Fixes #43763
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) {