From 6da0fcbfd6c08cbcfe53c5b0d4524046c9eaf03c Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Mon, 2 Jun 2003 19:13:45 +0000 Subject: Fixes part of #43388 2003-06-02 Rodrigo Moya 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 --- calendar/ChangeLog | 8 ++++++++ calendar/importers/icalendar-importer.c | 27 +++++++++++++-------------- 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 + + 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 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) { -- cgit v1.2.3