aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog9
-rw-r--r--calendar/cal-util/calobj.c48
-rw-r--r--calendar/cal-util/calobj.h6
-rw-r--r--calendar/conduits/calendar/calendar-conduit.c8
-rw-r--r--calendar/gui/calendar-conduit.c8
-rw-r--r--calendar/gui/calendar-pilot-sync.c4
-rw-r--r--calendar/pcs/cal-backend-imc.c4
7 files changed, 45 insertions, 42 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 9a384b3337..146ea65813 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,12 @@
+2000-06-06 Federico Mena Quintero <federico@helixcode.com>
+
+ * 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.
+
2000-06-02 Federico Mena Quintero <federico@helixcode.com>
* gui/calendar-commands.c (print): New function to call the print
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);
diff --git a/calendar/conduits/calendar/calendar-conduit.c b/calendar/conduits/calendar/calendar-conduit.c
index 8aa0e23a3f..2cddd84186 100644
--- a/calendar/conduits/calendar/calendar-conduit.c
+++ b/calendar/conduits/calendar/calendar-conduit.c
@@ -501,12 +501,12 @@ update_record (GnomePilotConduitStandardAbs *conduit,
WARN (_("Error while communicating with calendar server"));
show_exception(&(ctxt->ev));
CORBA_exception_free(&(ctxt->ev));
- ical_object_destroy (obj);
+ ical_object_unref (obj);
free_Appointment(&a);
return -1;
} else {
LOG ("Found");
- ical_object_destroy (obj);
+ ical_object_unref (obj);
obj = ical_object_new_from_string (vcal_string);
ical_from_remote_record(conduit,remote,obj);
CORBA_free(vcal_string);
@@ -519,7 +519,7 @@ update_record (GnomePilotConduitStandardAbs *conduit,
/*
* Shutdown
*/
- ical_object_destroy (obj);
+ ical_object_unref (obj);
free_Appointment(&a);
return 0;
@@ -649,7 +649,7 @@ free_match (GnomePilotConduitStandardAbs *conduit,
g_return_val_if_fail(local!=NULL,-1);
g_return_val_if_fail(*local!=NULL,-1);
- ical_object_destroy (GCAL_LOCALRECORD(*local)->ical);
+ ical_object_unref (GCAL_LOCALRECORD(*local)->ical);
g_free(*local);
*local = NULL;
diff --git a/calendar/gui/calendar-conduit.c b/calendar/gui/calendar-conduit.c
index 8aa0e23a3f..2cddd84186 100644
--- a/calendar/gui/calendar-conduit.c
+++ b/calendar/gui/calendar-conduit.c
@@ -501,12 +501,12 @@ update_record (GnomePilotConduitStandardAbs *conduit,
WARN (_("Error while communicating with calendar server"));
show_exception(&(ctxt->ev));
CORBA_exception_free(&(ctxt->ev));
- ical_object_destroy (obj);
+ ical_object_unref (obj);
free_Appointment(&a);
return -1;
} else {
LOG ("Found");
- ical_object_destroy (obj);
+ ical_object_unref (obj);
obj = ical_object_new_from_string (vcal_string);
ical_from_remote_record(conduit,remote,obj);
CORBA_free(vcal_string);
@@ -519,7 +519,7 @@ update_record (GnomePilotConduitStandardAbs *conduit,
/*
* Shutdown
*/
- ical_object_destroy (obj);
+ ical_object_unref (obj);
free_Appointment(&a);
return 0;
@@ -649,7 +649,7 @@ free_match (GnomePilotConduitStandardAbs *conduit,
g_return_val_if_fail(local!=NULL,-1);
g_return_val_if_fail(*local!=NULL,-1);
- ical_object_destroy (GCAL_LOCALRECORD(*local)->ical);
+ ical_object_unref (GCAL_LOCALRECORD(*local)->ical);
g_free(*local);
*local = NULL;
diff --git a/calendar/gui/calendar-pilot-sync.c b/calendar/gui/calendar-pilot-sync.c
index 7378f796fd..98740a51f4 100644
--- a/calendar/gui/calendar-pilot-sync.c
+++ b/calendar/gui/calendar-pilot-sync.c
@@ -172,7 +172,7 @@ update_record (GNOME_Calendar_Repository repo, int id, struct Appointment *a, in
if (obj->pilot_status == ICAL_PILOT_SYNC_MOD){
printf (_("\tObject has been modified on desktop and on the pilot, desktop takes precedence\n"));
- ical_object_destroy (obj);
+ ical_object_unref (obj);
return;
}
@@ -313,7 +313,7 @@ update_record (GNOME_Calendar_Repository repo, int id, struct Appointment *a, in
/*
* Shutdown
*/
- ical_object_destroy (obj);
+ ical_object_unref (obj);
}
/*
diff --git a/calendar/pcs/cal-backend-imc.c b/calendar/pcs/cal-backend-imc.c
index 3c50078d12..46c8f0dba0 100644
--- a/calendar/pcs/cal-backend-imc.c
+++ b/calendar/pcs/cal-backend-imc.c
@@ -265,7 +265,7 @@ free_ical_object (gpointer key, gpointer value, gpointer data)
iCalObject *ico;
ico = value;
- ical_object_destroy (ico);
+ ical_object_unref (ico);
}
/* Destroys an IMC backend's data */
@@ -461,7 +461,7 @@ remove_object (CalBackendIMC *cbimc, iCalObject *ico)
*list = g_list_remove_link (*list, l);
g_list_free_1 (l);
- ical_object_destroy (ico);
+ ical_object_unref (ico);
}
/* Load a calendar from a VObject */