From ae33d3f67e77c5182dec21c388605b4a4ae48e51 Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Tue, 6 Jun 2000 18:15:57 +0000 Subject: Removed from the public header; made static. Now everyone should use 2000-06-06 Federico Mena Quintero * cal-util/calobj.c (ical_object_destroy): Removed from the public header; made static. Now everyone should use refcounting. * pcs/cal-backend-imc.c (free_ical_object): Use ical_object_unref(). (remove_object): Likewise. svn path=/trunk/; revision=3439 --- calendar/cal-util/calobj.c | 48 +++++++++++++++++++++++----------------------- calendar/cal-util/calobj.h | 6 ------ 2 files changed, 24 insertions(+), 30 deletions(-) (limited to 'calendar/cal-util') diff --git a/calendar/cal-util/calobj.c b/calendar/cal-util/calobj.c index d2c47fbc65..9e86011d9f 100644 --- a/calendar/cal-util/calobj.c +++ b/calendar/cal-util/calobj.c @@ -104,31 +104,9 @@ ical_object_ref (iCalObject *ico) } -void -ical_object_unref (iCalObject *ico) -{ - ico->ref_count--; - if (ico->ref_count == 0) - ical_object_destroy (ico); -} - - -static void -my_free (gpointer data, gpointer user_dat_ignored) -{ - g_free (data); -} - -static void -list_free (GList *list) -{ - g_list_foreach (list, my_free, 0); - g_list_free (list); -} - #define free_if_defined(x) if (x){ g_free (x); x = 0; } #define lfree_if_defined(x) if (x){ list_free (x); x = 0; } -void +static void ical_object_destroy (iCalObject *ico) { /* Regular strings */ @@ -157,6 +135,28 @@ ical_object_destroy (iCalObject *ico) g_free (ico); } +void +ical_object_unref (iCalObject *ico) +{ + ico->ref_count--; + if (ico->ref_count == 0) + ical_object_destroy (ico); +} + + +static void +my_free (gpointer data, gpointer user_dat_ignored) +{ + g_free (data); +} + +static void +list_free (GList *list) +{ + g_list_foreach (list, my_free, 0); + g_list_free (list); +} + /* This resets any recurrence rules of the iCalObject. */ void ical_object_reset_recurrence (iCalObject *ico) @@ -830,7 +830,7 @@ ical_object_create_from_vobject (VObject *o, const char *object_name) /* rrule */ if (has (o, VCRRuleProp)){ if (!load_recurrence (ical, str_val (vo))) { - ical_object_destroy (ical); + ical_object_unref (ical); return NULL; } free (the_str); diff --git a/calendar/cal-util/calobj.h b/calendar/cal-util/calobj.h index cf5483a228..f2e5dbe00c 100644 --- a/calendar/cal-util/calobj.h +++ b/calendar/cal-util/calobj.h @@ -231,15 +231,9 @@ typedef int (*calendarfn) (iCalObject *, time_t, time_t, void *); iCalObject *ical_new (char *comment, char *organizer, char *summary); iCalObject *ical_object_new (void); -/* iCalObjects are created with a refcount of 1. When it drops to 0 it is - destroyed with ical_object_destroy(). To maintain backwards compatability - ical_object_destroy() can still be used, though code which uses it should - not be mixed with code that uses refcounts. */ void ical_object_ref (iCalObject *ico); void ical_object_unref (iCalObject *ico); -void ical_object_destroy (iCalObject *ico); - iCalObject *ical_object_create_from_vobject (VObject *obj, const char *object_name); VObject *ical_object_to_vobject (iCalObject *ical); iCalObject *ical_object_duplicate (iCalObject *o); -- cgit v1.2.3