{
const gchar *xstr;
- g_assert (icalproperty_isa (prop) == ICAL_X_PROPERTY);
+ g_return_val_if_fail (icalproperty_isa (prop) == ICAL_X_PROPERTY, NULL);
xstr = icalproperty_get_x (prop);
- g_assert (xstr != NULL);
+ g_return_val_if_fail (xstr != NULL, NULL);
return xstr;
}
const gchar *xname;
xname = icalproperty_get_x_name (prop);
- g_assert (xname != NULL);
+ g_return_if_fail (xname != NULL);
if (strcmp (xname, EVOLUTION_ALARM_UID_PROPERTY) == 0)
list = g_slist_prepend (list, prop);
const gchar *xname;
xname = icalproperty_get_x_name (prop);
- g_assert (xname != NULL);
+ g_return_if_fail (xname != NULL);
if (strcmp (xname, EVOLUTION_ALARM_UID_PROPERTY) == 0) {
auid = alarm_uid_from_prop (prop);
priv = comp->priv;
- g_assert (priv->icalcomp != NULL);
+ g_return_if_fail (priv->icalcomp != NULL);
/* Scan properties */
ECalComponentPrivate *priv;
priv = comp->priv;
- g_assert (priv->icalcomp != NULL);
+ g_return_if_fail (priv->icalcomp != NULL);
if (!priv->uid) {
gchar *uid;
break;
default:
- g_assert_not_reached ();
+ g_warn_if_reached ();
kind = ICAL_NO_COMPONENT;
}
default:
/* We should have been loaded with a supported type! */
- g_assert_not_reached ();
+ g_warn_if_reached ();
return E_CAL_COMPONENT_NO_TYPE;
}
}
g_return_if_fail (priv->icalcomp != NULL);
/* This MUST exist, since we ensured that it did */
- g_assert (priv->uid != NULL);
+ g_return_if_fail (priv->uid != NULL);
*uid = icalproperty_get_uid (priv->uid);
}
g_return_if_fail (priv->icalcomp != NULL);
/* This MUST exist, since we ensured that it did */
- g_assert (priv->uid != NULL);
+ g_return_if_fail (priv->uid != NULL);
icalproperty_set_uid (priv->uid, (gchar *) uid);
}
gchar *buf = NULL;
attachment = l->data;
- g_assert (attachment->attach != NULL);
+ g_return_if_fail (attachment->attach != NULL);
if (icalattach_get_is_url (attachment->attach)) {
/* FIXME : this ref count is screwed up
struct attachment *attachment;
attachment = l->data;
- g_assert (attachment->prop != NULL);
- g_assert (attachment->attach != NULL);
+ g_return_if_fail (attachment->prop != NULL);
+ g_return_if_fail (attachment->attach != NULL);
icalcomponent_remove_property (icalcomp, attachment->prop);
icalproperty_free (attachment->prop);
}
categories = icalproperty_get_categories (priv->categories);
- g_assert (categories != NULL);
+ g_return_if_fail (categories != NULL);
cat_start = categories;
*categ_list = NULL;
break;
default:
- g_assert_not_reached ();
+ g_warn_if_reached ();
class = ICAL_CLASS_NONE;
}
ECalComponentText *t;
text = l->data;
- g_assert (text->prop != NULL);
+ g_return_if_fail (text->prop != NULL);
t = g_new (ECalComponentText, 1);
t->value = (* get_prop_func) (text->prop);
struct text *text;
text = l->data;
- g_assert (text->prop != NULL);
+ g_return_if_fail (text->prop != NULL);
icalcomponent_remove_property (priv->icalcomp, text->prop);
icalproperty_free (text->prop);
/* If the TZID is set to "UTC", we don't want to save the TZID. */
if (dt->tzid && strcmp (dt->tzid, "UTC")) {
- g_assert (datetime->prop != NULL);
+ g_return_if_fail (datetime->prop != NULL);
if (datetime->tzid_param) {
icalparameter_set_tzid (datetime->tzid_param, (gchar *) dt->tzid);
g_return_if_fail (priv->icalcomp != NULL);
/* This MUST exist, since we ensured that it did */
- g_assert (priv->dtstamp != NULL);
+ g_return_if_fail (priv->dtstamp != NULL);
*t = icalproperty_get_dtstamp (priv->dtstamp);
}
g_return_if_fail (priv->icalcomp != NULL);
/* This MUST exist, since we ensured that it did */
- g_assert (priv->dtstamp != NULL);
+ g_return_if_fail (priv->dtstamp != NULL);
icalproperty_set_dtstamp (priv->dtstamp, *t);
}
struct icaldatetimeperiodtype ip;
period = l->data;
- g_assert (period->prop != NULL);
+ g_return_if_fail (period->prop != NULL);
p = g_new (ECalComponentPeriod, 1);
else if (p->type == E_CAL_COMPONENT_PERIOD_DURATION)
p->u.duration = ip.period.duration;
else
- g_assert_not_reached ();
+ g_return_if_reached ();
/* Put in list */
struct period *period;
period = l->data;
- g_assert (period->prop != NULL);
+ g_return_if_fail (period->prop != NULL);
icalcomponent_remove_property (priv->icalcomp, period->prop);
icalproperty_free (period->prop);
struct icaldatetimeperiodtype ip = {};
icalparameter_value value_type;
- g_assert (l->data != NULL);
+ g_return_if_fail (l->data != NULL);
p = l->data;
/* Create libical value */
value_type = ICAL_VALUE_DURATION;
ip.period.duration = p->u.duration;
} else {
- g_assert_not_reached ();
- return;
+ g_return_if_reached ();
}
/* Create property */
ECalComponentDateTime *cdt;
struct datetime *dt;
- g_assert (l->data != NULL);
+ g_return_if_fail (l->data != NULL);
cdt = l->data;
- g_assert (cdt->value != NULL);
+ g_return_if_fail (cdt->value != NULL);
dt = g_new (struct datetime, 1);
dt->prop = icalproperty_new_exdate (*cdt->value);
icalproperty *prop;
struct icalrecurrencetype *recur;
- g_assert (l->data != NULL);
+ g_return_if_fail (l->data != NULL);
recur = l->data;
prop = (* new_prop_func) (*recur);
}
if (organizer->sentby) {
- g_assert (priv->organizer.prop != NULL);
+ g_return_if_fail (priv->organizer.prop != NULL);
if (priv->organizer.sentby_param)
icalparameter_set_sentby (priv->organizer.sentby_param,
}
if (organizer->cn) {
- g_assert (priv->organizer.prop != NULL);
+ g_return_if_fail (priv->organizer.prop != NULL);
if (priv->organizer.cn_param)
icalparameter_set_cn (priv->organizer.cn_param,
}
if (organizer->language) {
- g_assert (priv->organizer.prop != NULL);
+ g_return_if_fail (priv->organizer.prop != NULL);
if (priv->organizer.language_param)
icalparameter_set_language (priv->organizer.language_param,
}
if (summary->altrep) {
- g_assert (priv->summary.prop != NULL);
+ g_return_if_fail (priv->summary.prop != NULL);
if (priv->summary.altrep_param)
icalparameter_set_altrep (priv->summary.altrep_param,
break;
default:
- g_assert_not_reached ();
+ g_warn_if_reached ();
ical_transp = ICAL_TRANSP_NONE;
}
ECalComponentAttendee *a;
attendee = l->data;
- g_assert (attendee->prop != NULL);
+ g_return_if_fail (attendee->prop != NULL);
a = g_new0 (ECalComponentAttendee, 1);
a->value = icalproperty_get_attendee (attendee->prop);
struct attendee *attendee;
attendee = l->data;
- g_assert (attendee->prop != NULL);
+ g_return_if_fail (attendee->prop != NULL);
icalcomponent_remove_property (icalcomp, attendee->prop);
icalproperty_free (attendee->prop);
for (l = exdate_list; l; l = l->next) {
ECalComponentDateTime *cdt;
- g_assert (l->data != NULL);
+ g_return_if_fail (l->data != NULL);
cdt = l->data;
- g_assert (cdt->value != NULL);
+ g_return_if_fail (cdt->value != NULL);
g_free (cdt->value);
g_free ((gchar *)cdt->tzid);
void
e_cal_component_free_period_list (GSList *period_list)
{
- GSList *l;
-
- for (l = period_list; l; l = l->next) {
- ECalComponentPeriod *period;
-
- g_assert (l->data != NULL);
-
- period = l->data;
- g_free (period);
- }
-
+ g_slist_foreach (period_list, (GFunc) g_free, NULL);
g_slist_free (period_list);
}
void
e_cal_component_free_recur_list (GSList *recur_list)
{
- GSList *l;
-
- for (l = recur_list; l; l = l->next) {
- struct icalrecurrencetype *r;
-
- g_assert (l->data != NULL);
- r = l->data;
-
- g_free (r);
- }
-
+ g_slist_foreach (recur_list, (GFunc) g_free, NULL);
g_slist_free (recur_list);
}
void
e_cal_component_free_text_list (GSList *text_list)
{
- GSList *l;
-
- for (l = text_list; l; l = l->next) {
- ECalComponentText *text;
-
- g_assert (l->data != NULL);
-
- text = l->data;
- g_return_if_fail (text != NULL);
- g_free (text);
- }
-
+ g_slist_foreach (text_list, (GFunc) g_free, NULL);
g_slist_free (text_list);
}
void
e_cal_component_free_attendee_list (GSList *attendee_list)
{
- GSList *l;
-
- for (l = attendee_list; l; l = l->next) {
- ECalComponentAttendee *attendee;
-
- g_assert (l->data != NULL);
-
- attendee = l->data;
- g_return_if_fail (attendee != NULL);
- g_free (attendee);
- }
-
+ g_slist_foreach (attendee_list, (GFunc) g_free, NULL);
g_slist_free (attendee_list);
}
case ICAL_X_PROPERTY:
xname = icalproperty_get_x_name (prop);
- g_assert (xname != NULL);
+ g_return_if_fail (xname != NULL);
if (strcmp (xname, EVOLUTION_ALARM_UID_PROPERTY) == 0)
alarm->uid = prop;
prop = icalcomponent_get_next_property (subcomp, ICAL_ANY_PROPERTY))
scan_alarm_property (alarm, prop);
- g_assert (alarm->uid != NULL);
+ g_return_val_if_fail (alarm->uid != NULL, NULL);
return alarm;
}
const gchar *xname;
xname = icalproperty_get_x_name (prop);
- g_assert (xname != NULL);
+ g_return_val_if_fail (xname != NULL, NULL);
if (strcmp (xname, EVOLUTION_ALARM_UID_PROPERTY) == 0) {
const gchar *auid;
g_return_if_fail (alarms != NULL);
- g_assert (alarms->comp != NULL);
- g_object_unref (G_OBJECT (alarms->comp));
+ if (alarms->comp != NULL)
+ g_object_unref (alarms->comp);
for (l = alarms->alarms; l; l = l->next) {
- ECalComponentAlarmInstance *instance;
+ ECalComponentAlarmInstance *instance = l->data;
- instance = l->data;
- g_assert (instance != NULL);
- g_free (instance->auid);
- g_free (instance);
+ if (instance != NULL) {
+ g_free (instance->auid);
+ g_free (instance);
+ } else
+ g_warn_if_reached ();
}
g_slist_free (alarms->alarms);
GSList *l;
g_return_if_fail (alarm != NULL);
-
- g_assert (alarm->icalcomp != NULL);
+ g_return_if_fail (alarm->icalcomp != NULL);
if (icalcomponent_get_parent (alarm->icalcomp) == NULL)
icalcomponent_free (alarm->icalcomp);
g_return_if_fail (alarm != NULL);
g_return_if_fail (action != NULL);
-
- g_assert (alarm->icalcomp != NULL);
+ g_return_if_fail (alarm->icalcomp != NULL);
if (!alarm->action) {
*action = E_CAL_COMPONENT_ALARM_NONE;
g_return_if_fail (alarm != NULL);
g_return_if_fail (action != E_CAL_COMPONENT_ALARM_NONE);
g_return_if_fail (action != E_CAL_COMPONENT_ALARM_UNKNOWN);
-
- g_assert (alarm->icalcomp != NULL);
+ g_return_if_fail (alarm->icalcomp != NULL);
switch (action) {
case E_CAL_COMPONENT_ALARM_AUDIO:
break;
default:
- g_assert_not_reached ();
+ g_warn_if_reached ();
ipa = ICAL_ACTION_NONE;
}
{
g_return_if_fail (alarm != NULL);
g_return_if_fail (attach != NULL);
-
- g_assert (alarm->icalcomp != NULL);
+ g_return_if_fail (alarm->icalcomp != NULL);
if (alarm->attach) {
*attach = icalproperty_get_attach (alarm->attach);
e_cal_component_alarm_set_attach (ECalComponentAlarm *alarm, icalattach *attach)
{
g_return_if_fail (alarm != NULL);
-
- g_assert (alarm->icalcomp != NULL);
+ g_return_if_fail (alarm->icalcomp != NULL);
if (alarm->attach) {
icalcomponent_remove_property (alarm->icalcomp, alarm->attach);
{
g_return_if_fail (alarm != NULL);
g_return_if_fail (description != NULL);
-
- g_assert (alarm->icalcomp != NULL);
+ g_return_if_fail (alarm->icalcomp != NULL);
if (alarm->description.prop)
description->value = icalproperty_get_description (alarm->description.prop);
e_cal_component_alarm_set_description (ECalComponentAlarm *alarm, ECalComponentText *description)
{
g_return_if_fail (alarm != NULL);
-
- g_assert (alarm->icalcomp != NULL);
+ g_return_if_fail (alarm->icalcomp != NULL);
if (alarm->description.prop) {
icalcomponent_remove_property (alarm->icalcomp, alarm->description.prop);
{
g_return_if_fail (alarm != NULL);
g_return_if_fail (repeat != NULL);
-
- g_assert (alarm->icalcomp != NULL);
+ g_return_if_fail (alarm->icalcomp != NULL);
if (!(alarm->repeat && alarm->duration)) {
repeat->repetitions = 0;
{
g_return_if_fail (alarm != NULL);
g_return_if_fail (repeat.repetitions >= 0);
-
- g_assert (alarm->icalcomp != NULL);
+ g_return_if_fail (alarm->icalcomp != NULL);
/* Delete old properties */
g_return_if_fail (alarm != NULL);
g_return_if_fail (trigger != NULL);
-
- g_assert (alarm->icalcomp != NULL);
+ g_return_if_fail (alarm->icalcomp != NULL);
if (!alarm->trigger) {
trigger->type = E_CAL_COMPONENT_ALARM_TRIGGER_NONE;
break;
default:
- g_assert_not_reached ();
+ g_return_if_reached ();
}
} else
trigger->type = E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START;
g_return_if_fail (alarm != NULL);
g_return_if_fail (trigger.type != E_CAL_COMPONENT_ALARM_TRIGGER_NONE);
-
- g_assert (alarm->icalcomp != NULL);
+ g_return_if_fail (alarm->icalcomp != NULL);
/* Delete old trigger */
break;
default:
- g_assert_not_reached ();
- return;
+ g_return_if_reached ();
}
alarm->trigger = icalproperty_new_trigger (t);