[evolution-data-server] Remove e_return_data_cal_error_val_if_fail() macro.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Remove e_return_data_cal_error_val_if_fail() macro.
- Date: Mon, 1 Apr 2013 22:14:07 +0000 (UTC)
commit 2ddf7a2f781444f6949633e662b848214fdbad3b
Author: Matthew Barnes <mbarnes redhat com>
Date: Mon Apr 1 17:56:53 2013 -0400
Remove e_return_data_cal_error_val_if_fail() macro.
No longer used, and backends had been mainly misusing it anyway.
calendar/backends/caldav/e-cal-backend-caldav.c | 37 ++++------
.../backends/contacts/e-cal-backend-contacts.c | 6 --
calendar/backends/file/e-cal-backend-file.c | 75 +++++++++++++------
calendar/backends/http/e-cal-backend-http.c | 10 ---
calendar/backends/weather/e-cal-backend-weather.c | 18 ++---
calendar/libedata-cal/e-data-cal.h | 22 ------
.../libedata-cal/libedata-cal-sections.txt | 1 -
7 files changed, 75 insertions(+), 94 deletions(-)
---
diff --git a/calendar/backends/caldav/e-cal-backend-caldav.c b/calendar/backends/caldav/e-cal-backend-caldav.c
index 2ced0e1..ebca58e 100644
--- a/calendar/backends/caldav/e-cal-backend-caldav.c
+++ b/calendar/backends/caldav/e-cal-backend-caldav.c
@@ -1750,11 +1750,6 @@ caldav_post_freebusy (ECalBackendCalDAV *cbdav,
{
SoupMessage *message;
- e_return_data_cal_error_if_fail (cbdav != NULL, InvalidArg);
- e_return_data_cal_error_if_fail (url != NULL, InvalidArg);
- e_return_data_cal_error_if_fail (post_fb != NULL, InvalidArg);
- e_return_data_cal_error_if_fail (*post_fb != NULL, InvalidArg);
-
message = soup_message_new (SOUP_METHOD_POST, url);
if (message == NULL) {
g_propagate_error (error, EDC_ERROR (NoSuchCal));
@@ -4019,7 +4014,14 @@ do_modify_objects (ECalBackendCalDAV *cbdav,
sanitize_component ((ECalBackend *) cbdav, comp);
id = e_cal_component_get_id (comp);
- e_return_data_cal_error_if_fail (id != NULL, InvalidObject);
+ if (id == NULL) {
+ g_set_error_literal (
+ error, E_CAL_CLIENT_ERROR,
+ E_CAL_CLIENT_ERROR_INVALID_OBJECT,
+ e_cal_client_error_to_string (
+ E_CAL_CLIENT_ERROR_INVALID_OBJECT));
+ return;
+ }
/* fetch full component from cache, it will be pushed to the server */
cache_comp = get_comp_from_cache (cbdav, id->uid, NULL, &href, &etag);
@@ -4257,9 +4259,6 @@ extract_objects (icalcomponent *icomp,
icalcomponent *scomp;
icalcomponent_kind kind;
- e_return_data_cal_error_if_fail (icomp, InvalidArg);
- e_return_data_cal_error_if_fail (objects, InvalidArg);
-
kind = icalcomponent_isa (icomp);
if (kind == ekind) {
@@ -4338,7 +4337,14 @@ process_object (ECalBackendCalDAV *cbdav,
backend = E_CAL_BACKEND (cbdav);
- e_return_data_cal_error_if_fail (id != NULL, InvalidObject);
+ if (id == NULL) {
+ g_set_error_literal (
+ error, E_CAL_CLIENT_ERROR,
+ E_CAL_CLIENT_ERROR_INVALID_OBJECT,
+ e_cal_client_error_to_string (
+ E_CAL_CLIENT_ERROR_INVALID_OBJECT));
+ return;
+ }
registry = e_cal_backend_get_registry (E_CAL_BACKEND (cbdav));
@@ -4667,15 +4673,10 @@ caldav_add_timezone (ECalBackendSync *backend,
GError **error)
{
ETimezoneCache *timezone_cache;
- ECalBackendCalDAV *cbdav;
icalcomponent *tz_comp;
- cbdav = E_CAL_BACKEND_CALDAV (backend);
timezone_cache = E_TIMEZONE_CACHE (backend);
- e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_CALDAV (cbdav), InvalidArg);
- e_return_data_cal_error_if_fail (tzobj != NULL, InvalidArg);
-
tz_comp = icalparser_parse_string (tzobj);
if (!tz_comp) {
g_propagate_error (error, EDC_ERROR (InvalidObject));
@@ -4829,10 +4830,6 @@ caldav_get_free_busy (ECalBackendSync *backend,
cbdav = E_CAL_BACKEND_CALDAV (backend);
- e_return_data_cal_error_if_fail (users != NULL, InvalidArg);
- e_return_data_cal_error_if_fail (freebusy != NULL, InvalidArg);
- e_return_data_cal_error_if_fail (start < end, InvalidArg);
-
if (!cbdav->priv->calendar_schedule) {
g_propagate_error (error, EDC_ERROR_EX (OtherError, _("Calendar doesn't support Free/Busy")));
return;
@@ -4922,8 +4919,6 @@ caldav_get_free_busy (ECalBackendSync *backend,
icalcomponent_free (icalcomp);
g_object_unref (comp);
- e_return_data_cal_error_if_fail (str != NULL, OtherError);
-
caldav_post_freebusy (cbdav, cbdav->priv->schedule_outbox_url, &str, cancellable, &err);
if (!err) {
diff --git a/calendar/backends/contacts/e-cal-backend-contacts.c
b/calendar/backends/contacts/e-cal-backend-contacts.c
index 16e7b5a..03326a7 100644
--- a/calendar/backends/contacts/e-cal-backend-contacts.c
+++ b/calendar/backends/contacts/e-cal-backend-contacts.c
@@ -1153,15 +1153,9 @@ e_cal_backend_contacts_add_timezone (ECalBackendSync *backend,
const gchar *tzobj,
GError **error)
{
- ECalBackendContacts *cbcontacts;
icalcomponent *tz_comp;
icaltimezone *zone;
- cbcontacts = (ECalBackendContacts *) backend;
-
- e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_CONTACTS (cbcontacts), InvalidArg);
- e_return_data_cal_error_if_fail (tzobj != NULL, InvalidArg);
-
tz_comp = icalparser_parse_string (tzobj);
if (!tz_comp) {
g_propagate_error (error, EDC_ERROR (InvalidObject));
diff --git a/calendar/backends/file/e-cal-backend-file.c b/calendar/backends/file/e-cal-backend-file.c
index de3cbe0..f4aa5be 100644
--- a/calendar/backends/file/e-cal-backend-file.c
+++ b/calendar/backends/file/e-cal-backend-file.c
@@ -1434,8 +1434,16 @@ e_cal_backend_file_get_object (ECalBackendSync *backend,
cbfile = E_CAL_BACKEND_FILE (backend);
priv = cbfile->priv;
- e_return_data_cal_error_if_fail (priv->icalcomp != NULL, InvalidObject);
- e_return_data_cal_error_if_fail (uid != NULL, ObjectNotFound);
+ if (priv->icalcomp == NULL) {
+ g_set_error_literal (
+ error, E_CAL_CLIENT_ERROR,
+ E_CAL_CLIENT_ERROR_INVALID_OBJECT,
+ e_cal_client_error_to_string (
+ E_CAL_CLIENT_ERROR_INVALID_OBJECT));
+ return;
+ }
+
+ g_return_if_fail (uid != NULL);
g_assert (priv->comp_uid_hash != NULL);
g_rec_mutex_lock (&priv->idle_save_rmutex);
@@ -1513,14 +1521,9 @@ e_cal_backend_file_add_timezone (ECalBackendSync *backend,
{
ETimezoneCache *timezone_cache;
icalcomponent *tz_comp;
- ECalBackendFile *cbfile;
- cbfile = (ECalBackendFile *) backend;
timezone_cache = E_TIMEZONE_CACHE (backend);
- e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_FILE (cbfile), InvalidArg);
- e_return_data_cal_error_if_fail (tzobj != NULL, InvalidArg);
-
tz_comp = icalparser_parse_string (tzobj);
if (!tz_comp) {
g_propagate_error (error, EDC_ERROR (InvalidObject));
@@ -1753,9 +1756,6 @@ e_cal_backend_file_get_attachment_uris (ECalBackendSync *backend,
cbfile = E_CAL_BACKEND_FILE (backend);
priv = cbfile->priv;
- e_return_data_cal_error_if_fail (priv->icalcomp != NULL, InvalidObject);
- e_return_data_cal_error_if_fail (uid != NULL, ObjectNotFound);
- e_return_data_cal_error_if_fail (attachment_uris != NULL, InvalidArg);
g_assert (priv->comp_uid_hash != NULL);
g_rec_mutex_lock (&priv->idle_save_rmutex);
@@ -2042,9 +2042,14 @@ e_cal_backend_file_get_free_busy (ECalBackendSync *backend,
cbfile = E_CAL_BACKEND_FILE (backend);
priv = cbfile->priv;
- e_return_data_cal_error_if_fail (priv->icalcomp != NULL, NoSuchCal);
- e_return_data_cal_error_if_fail (start != -1 && end != -1, InvalidRange);
- e_return_data_cal_error_if_fail (start <= end, InvalidRange);
+ if (priv->icalcomp == NULL) {
+ g_set_error_literal (
+ error, E_CAL_CLIENT_ERROR,
+ E_CAL_CLIENT_ERROR_NO_SUCH_CALENDAR,
+ e_cal_client_error_to_string (
+ E_CAL_CLIENT_ERROR_NO_SUCH_CALENDAR));
+ return;
+ }
g_rec_mutex_lock (&priv->idle_save_rmutex);
@@ -2143,9 +2148,14 @@ e_cal_backend_file_create_objects (ECalBackendSync *backend,
cbfile = E_CAL_BACKEND_FILE (backend);
priv = cbfile->priv;
- e_return_data_cal_error_if_fail (priv->icalcomp != NULL, NoSuchCal);
- e_return_data_cal_error_if_fail (in_calobjs != NULL, ObjectNotFound);
- e_return_data_cal_error_if_fail (new_components != NULL, ObjectNotFound);
+ if (priv->icalcomp == NULL) {
+ g_set_error_literal (
+ error, E_CAL_CLIENT_ERROR,
+ E_CAL_CLIENT_ERROR_NO_SUCH_CALENDAR,
+ e_cal_client_error_to_string (
+ E_CAL_CLIENT_ERROR_NO_SUCH_CALENDAR));
+ return;
+ }
if (uids)
*uids = NULL;
@@ -2303,8 +2313,15 @@ e_cal_backend_file_modify_objects (ECalBackendSync *backend,
cbfile = E_CAL_BACKEND_FILE (backend);
priv = cbfile->priv;
- e_return_data_cal_error_if_fail (priv->icalcomp != NULL, NoSuchCal);
- e_return_data_cal_error_if_fail (calobjs != NULL, ObjectNotFound);
+ if (priv->icalcomp == NULL) {
+ g_set_error_literal (
+ error, E_CAL_CLIENT_ERROR,
+ E_CAL_CLIENT_ERROR_NO_SUCH_CALENDAR,
+ e_cal_client_error_to_string (
+ E_CAL_CLIENT_ERROR_NO_SUCH_CALENDAR));
+ return;
+ }
+
switch (mod) {
case E_CAL_OBJ_MOD_THIS:
case E_CAL_OBJ_MOD_THIS_AND_PRIOR:
@@ -2788,10 +2805,14 @@ e_cal_backend_file_remove_objects (ECalBackendSync *backend,
cbfile = E_CAL_BACKEND_FILE (backend);
priv = cbfile->priv;
- e_return_data_cal_error_if_fail (priv->icalcomp != NULL, NoSuchCal);
- e_return_data_cal_error_if_fail (ids != NULL, ObjectNotFound);
- e_return_data_cal_error_if_fail (old_components != NULL, ObjectNotFound);
- e_return_data_cal_error_if_fail (new_components != NULL, ObjectNotFound);
+ if (priv->icalcomp == NULL) {
+ g_set_error_literal (
+ error, E_CAL_CLIENT_ERROR,
+ E_CAL_CLIENT_ERROR_NO_SUCH_CALENDAR,
+ e_cal_client_error_to_string (
+ E_CAL_CLIENT_ERROR_NO_SUCH_CALENDAR));
+ return;
+ }
switch (mod) {
case E_CAL_OBJ_MOD_THIS:
@@ -3068,8 +3089,14 @@ e_cal_backend_file_receive_objects (ECalBackendSync *backend,
cbfile = E_CAL_BACKEND_FILE (backend);
priv = cbfile->priv;
- e_return_data_cal_error_if_fail (priv->icalcomp != NULL, InvalidArg);
- e_return_data_cal_error_if_fail (calobj != NULL, InvalidObject);
+ if (priv->icalcomp == NULL) {
+ g_set_error_literal (
+ error, E_CAL_CLIENT_ERROR,
+ E_CAL_CLIENT_ERROR_NO_SUCH_CALENDAR,
+ e_cal_client_error_to_string (
+ E_CAL_CLIENT_ERROR_NO_SUCH_CALENDAR));
+ return;
+ }
/* Pull the component from the string and ensure that it is sane */
toplevel_comp = icalparser_parse_string ((gchar *) calobj);
diff --git a/calendar/backends/http/e-cal-backend-http.c b/calendar/backends/http/e-cal-backend-http.c
index cb02e6e..8e2e179 100644
--- a/calendar/backends/http/e-cal-backend-http.c
+++ b/calendar/backends/http/e-cal-backend-http.c
@@ -1021,8 +1021,6 @@ e_cal_backend_http_get_object (ECalBackendSync *backend,
cbhttp = E_CAL_BACKEND_HTTP (backend);
priv = cbhttp->priv;
- e_return_data_cal_error_if_fail (uid != NULL, ObjectNotFound);
-
if (!priv->store) {
g_propagate_error (error, EDC_ERROR (ObjectNotFound));
return;
@@ -1046,17 +1044,12 @@ e_cal_backend_http_add_timezone (ECalBackendSync *backend,
const gchar *tzobj,
GError **error)
{
- ECalBackendHttp *cbhttp;
ETimezoneCache *timezone_cache;
icalcomponent *tz_comp;
icaltimezone *zone;
- cbhttp = (ECalBackendHttp *) backend;
timezone_cache = E_TIMEZONE_CACHE (backend);
- e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_HTTP (cbhttp), InvalidArg);
- e_return_data_cal_error_if_fail (tzobj != NULL, InvalidArg);
-
tz_comp = icalparser_parse_string (tzobj);
if (!tz_comp) {
g_propagate_error (error, EDC_ERROR (InvalidObject));
@@ -1339,9 +1332,6 @@ e_cal_backend_http_get_free_busy (ECalBackendSync *backend,
cbhttp = E_CAL_BACKEND_HTTP (backend);
priv = cbhttp->priv;
- e_return_data_cal_error_if_fail (start != -1 && end != -1, InvalidRange);
- e_return_data_cal_error_if_fail (start <= end, InvalidRange);
-
if (!priv->store) {
g_propagate_error (error, EDC_ERROR (NoSuchCal));
return;
diff --git a/calendar/backends/weather/e-cal-backend-weather.c
b/calendar/backends/weather/e-cal-backend-weather.c
index 12ede55..68ccaaf 100644
--- a/calendar/backends/weather/e-cal-backend-weather.c
+++ b/calendar/backends/weather/e-cal-backend-weather.c
@@ -567,9 +567,6 @@ e_cal_backend_weather_get_object (ECalBackendSync *backend,
ECalBackendWeatherPrivate *priv = cbw->priv;
ECalComponent *comp;
- e_return_data_cal_error_if_fail (uid != NULL, InvalidArg);
- e_return_data_cal_error_if_fail (priv->store != NULL, InvalidArg);
-
comp = e_cal_backend_store_get_component (priv->store, uid, rid);
if (!comp) {
g_propagate_error (error, EDC_ERROR (ObjectNotFound));
@@ -631,17 +628,18 @@ e_cal_backend_weather_add_timezone (ECalBackendSync *backend,
const gchar *tzobj,
GError **error)
{
- ECalBackendWeather *cbw;
icalcomponent *tz_comp;
icaltimezone *zone;
- cbw = (ECalBackendWeather *) backend;
-
- e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_WEATHER (cbw), InvalidArg);
- e_return_data_cal_error_if_fail (tzobj != NULL, InvalidArg);
-
tz_comp = icalparser_parse_string (tzobj);
- e_return_data_cal_error_if_fail (tz_comp != NULL, InvalidObject);
+ if (tz_comp == NULL) {
+ g_set_error_literal (
+ error, E_CAL_CLIENT_ERROR,
+ E_CAL_CLIENT_ERROR_INVALID_OBJECT,
+ e_cal_client_error_to_string (
+ E_CAL_CLIENT_ERROR_INVALID_OBJECT));
+ return;
+ }
if (icalcomponent_isa (tz_comp) != ICAL_VTIMEZONE_COMPONENT) {
g_propagate_error (error, EDC_ERROR (InvalidObject));
diff --git a/calendar/libedata-cal/e-data-cal.h b/calendar/libedata-cal/e-data-cal.h
index 2e396e7..2bec855 100644
--- a/calendar/libedata-cal/e-data-cal.h
+++ b/calendar/libedata-cal/e-data-cal.h
@@ -54,28 +54,6 @@
G_BEGIN_DECLS
-/**
- * e_return_data_cal_error_val_if_fail:
- *
- * Same as e_return_data_cal_error_if_fail(), only returns FALSE on a failure
- *
- * Since: 3.2
- **/
-#define e_return_data_cal_error_val_if_fail(expr, _code) \
- G_STMT_START { \
- if (G_LIKELY (expr)) { \
- } else { \
- g_log (G_LOG_DOMAIN, \
- G_LOG_LEVEL_CRITICAL, \
- "file %s: line %d (%s): assertion `%s' failed", \
- __FILE__, __LINE__, G_STRFUNC, #expr); \
- g_set_error (error, E_DATA_CAL_ERROR, (_code), \
- "file %s: line %d (%s): assertion `%s' failed", \
- __FILE__, __LINE__, G_STRFUNC, #expr); \
- return FALSE; \
- } \
- } G_STMT_END
-
struct _ECalBackend;
typedef struct _EDataCal EDataCal;
diff --git a/docs/reference/calendar/libedata-cal/libedata-cal-sections.txt
b/docs/reference/calendar/libedata-cal/libedata-cal-sections.txt
index 569213a..f6d5aae 100644
--- a/docs/reference/calendar/libedata-cal/libedata-cal-sections.txt
+++ b/docs/reference/calendar/libedata-cal/libedata-cal-sections.txt
@@ -251,7 +251,6 @@ EDataCalCallStatus
e_data_cal_create_error
e_data_cal_create_error_fmt
e_data_cal_status_to_string
-e_return_data_cal_error_val_if_fail
e_data_cal_new
e_data_cal_ref_backend
e_data_cal_get_connection
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]