summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2004-01-26 15:12:33 +0000
committerRodrigo Moya <rodrigo@src.gnome.org>2004-01-26 15:12:33 +0000
commit61be22b1b56f75b2080b4ec5aa566d7cd7c7b46e (patch)
tree65b29519b83b3833cbe44b45cca83aa786def804
parentb56a6c648f8ac567772ed3b3da82a7f6b757221a (diff)
downloadevolution-data-server-61be22b1b56f75b2080b4ec5aa566d7cd7c7b46e.tar.gz
don't allocate memory for ECalComponentAttendee's fields, make them just
2004-01-27 Rodrigo Moya <rodrigo@ximian.com> * backends/groupwise/e-gw-connection.c (get_attendee_list_from_soap_parameter): don't allocate memory for ECalComponentAttendee's fields, make them just point to the values contained in the SoupSoapResponse. (get_e_cal_component_from_soap_parameter): don't free ECalComponentAttendee's fields, free the structure. (e_gw_connection_send_item): fixed warnings. * backends/groupwise/e-cal-backend-groupwise.c (e_cal_backend_groupwise_get_object): (e_cal_backend_groupwise_remove): lock/unlock the mutex when accessing private fields.
-rw-r--r--calendar/ChangeLog19
-rw-r--r--calendar/backends/groupwise/e-cal-backend-groupwise.c17
-rw-r--r--calendar/backends/groupwise/e-gw-connection.c21
-rw-r--r--servers/groupwise/e-gw-connection.c21
4 files changed, 42 insertions, 36 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 8af6da0a1..c71e358e3 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,4 +1,19 @@
-2004-01-26 JP Rosevear <jpr@ximian.com>
+2004-01-27 Rodrigo Moya <rodrigo@ximian.com>
+
+ * backends/groupwise/e-gw-connection.c
+ (get_attendee_list_from_soap_parameter): don't allocate memory for
+ ECalComponentAttendee's fields, make them just point to the values
+ contained in the SoupSoapResponse.
+ (get_e_cal_component_from_soap_parameter): don't free
+ ECalComponentAttendee's fields, free the structure.
+ (e_gw_connection_send_item): fixed warnings.
+
+ * backends/groupwise/e-cal-backend-groupwise.c
+ (e_cal_backend_groupwise_get_object):
+ (e_cal_backend_groupwise_remove): lock/unlock the mutex when accessing
+ private fields.
+
+2004-01-27 JP Rosevear <jpr@ximian.com>
* libedata-cal/e-cal-backend-cache.c (get_filename_from_uri): take
a const uri
@@ -11,7 +26,7 @@
* libedata-cal/e-cal-backend-sexp.c (func_uid): make sure we
always set a return value
-2004-01-26 JP Rosevear <jpr@ximian.com>
+2004-01-27 JP Rosevear <jpr@ximian.com>
* backends/groupwise/e-gw-connection.c
(get_e_cal_component_from_soap_parameter): description is not
diff --git a/calendar/backends/groupwise/e-cal-backend-groupwise.c b/calendar/backends/groupwise/e-cal-backend-groupwise.c
index ef17d96a3..70f5f2aa3 100644
--- a/calendar/backends/groupwise/e-cal-backend-groupwise.c
+++ b/calendar/backends/groupwise/e-cal-backend-groupwise.c
@@ -352,10 +352,14 @@ e_cal_backend_groupwise_remove (ECalBackendSync *backend, EDataCal *cal)
cbgw = E_CAL_BACKEND_GROUPWISE (backend);
priv = cbgw->priv;
+ g_mutex_lock (priv->mutex);
+
/* remove the cache */
if (priv->cache)
e_file_cache_remove (E_FILE_CACHE (priv->cache));
+ g_mutex_unlock (priv->mutex);
+
return GNOME_Evolution_Calendar_Success;
}
@@ -455,7 +459,7 @@ e_cal_backend_groupwise_get_default_object (ECalBackendSync *backend, EDataCal *
*object = e_cal_component_get_as_string (comp);
g_object_unref (comp);
-
+
return GNOME_Evolution_Calendar_Success;
}
@@ -471,15 +475,20 @@ e_cal_backend_groupwise_get_object (ECalBackendSync *backend, EDataCal *cal, con
priv = cbgw->priv;
+ g_mutex_lock (priv->mutex);
+
/* search the object in the cache */
comp = e_cal_backend_cache_get_component (priv->cache, uid, rid);
if (comp) {
+ g_mutex_unlock (priv->mutex);
*object = e_cal_component_get_as_string (comp);
g_object_unref (comp);
return GNOME_Evolution_Calendar_Success;
}
+ g_mutex_unlock (priv->mutex);
+
/* callers will never have a uuid that is in server but not in cache */
return GNOME_Evolution_Calendar_ObjectNotFound;
}
@@ -569,7 +578,7 @@ e_cal_backend_groupwise_get_object_list (ECalBackendSync *backend, EDataCal *cal
g_list_free (components);
g_mutex_unlock (priv->mutex);
-
+
return GNOME_Evolution_Calendar_Success;
}
@@ -614,7 +623,7 @@ e_cal_backend_groupwise_get_free_busy (ECalBackendSync *backend, EDataCal *cal,
EGwConnectionStatus status;
ECalBackendGroupwise *cbgw;
EGwConnection *cnc;
-
+
cbgw = E_CAL_BACKEND_GROUPWISE (backend);
cnc = cbgw->priv->cnc;
@@ -637,7 +646,7 @@ e_cal_backend_groupwise_compute_changes_foreach_key (const char *key, gpointer d
{
ECalBackendGroupwiseComputeChangesData *be_data = data;
- if (!e_cal_backend_cache_get_component (be_data->backend->priv->cache, key, NULL)) {
+ if (!e_cal_backend_cache_get_component (be_data->backend->priv->cache, key, NULL)) {
ECalComponent *comp;
comp = e_cal_component_new ();
diff --git a/calendar/backends/groupwise/e-gw-connection.c b/calendar/backends/groupwise/e-gw-connection.c
index 0ce2ce956..2616a54a8 100644
--- a/calendar/backends/groupwise/e-gw-connection.c
+++ b/calendar/backends/groupwise/e-gw-connection.c
@@ -400,18 +400,18 @@ get_attendee_list_from_soap_parameter (SoupSoapParameter *param)
SoupSoapParameter *subparam;
attendee = g_new0 (ECalComponentAttendee, 1);
-
+
subparam = soup_soap_parameter_get_first_child_by_name (param_recipient, "email");
if (subparam) {
email = soup_soap_parameter_get_string_value (subparam);
if (email)
- attendee->value = g_strdup (email);
+ attendee->value = email;
}
subparam = soup_soap_parameter_get_first_child_by_name (param_recipient, "displayName");
if (subparam) {
cn = soup_soap_parameter_get_string_value (subparam);
if (cn)
- attendee->cn = g_strdup (cn);
+ attendee->cn = cn;
}
subparam = soup_soap_parameter_get_first_child_by_name (param_recipient, "distType");
@@ -424,7 +424,8 @@ get_attendee_list_from_soap_parameter (SoupSoapParameter *param)
attendee->role = ICAL_ROLE_OPTPARTICIPANT;
else
attendee->role = ICAL_ROLE_NONPARTICIPANT;
- }
+ }
+
list = g_slist_append (list, attendee);
}
@@ -549,19 +550,11 @@ get_e_cal_component_from_soap_parameter (SoupSoapParameter *param)
/* Property - attendee-list*/
subparam = soup_soap_parameter_get_first_child_by_name (param, "distribution");
/* FIXME what to do with 'from' data*/
-
subparam = soup_soap_parameter_get_first_child_by_name (subparam, "recipients");
if (subparam)
attendee_list = get_attendee_list_from_soap_parameter (subparam);
if (attendee_list) {
- GSList *l;
e_cal_component_set_attendee_list (comp, attendee_list);
- for (l = attendee_list; l != NULL; l = g_slist_next (l)) {
- ECalComponentAttendee *attendee;
- attendee = (ECalComponentAttendee*) l->data;
- g_free (attendee->cn);
- g_free (attendee->value);
- }
g_slist_foreach (attendee_list, (GFunc) g_free, NULL);
}
@@ -1088,9 +1081,7 @@ e_gw_connection_get_deltas (EGwConnection *cnc, ECalBackendCache *cache)
EGwConnectionStatus
e_gw_connection_send_item (EGwConnection *cnc, EGwItem *item)
{
- SoupSoapMessage *msg;
- SoupSoapResponse *response;
- EGwConnectionStatus status;
+ EGwConnectionStatus status = E_GW_CONNECTION_STATUS_UNKNOWN;
g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_CONNECTION);
g_return_val_if_fail (E_IS_GW_ITEM (item), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
diff --git a/servers/groupwise/e-gw-connection.c b/servers/groupwise/e-gw-connection.c
index 0ce2ce956..2616a54a8 100644
--- a/servers/groupwise/e-gw-connection.c
+++ b/servers/groupwise/e-gw-connection.c
@@ -400,18 +400,18 @@ get_attendee_list_from_soap_parameter (SoupSoapParameter *param)
SoupSoapParameter *subparam;
attendee = g_new0 (ECalComponentAttendee, 1);
-
+
subparam = soup_soap_parameter_get_first_child_by_name (param_recipient, "email");
if (subparam) {
email = soup_soap_parameter_get_string_value (subparam);
if (email)
- attendee->value = g_strdup (email);
+ attendee->value = email;
}
subparam = soup_soap_parameter_get_first_child_by_name (param_recipient, "displayName");
if (subparam) {
cn = soup_soap_parameter_get_string_value (subparam);
if (cn)
- attendee->cn = g_strdup (cn);
+ attendee->cn = cn;
}
subparam = soup_soap_parameter_get_first_child_by_name (param_recipient, "distType");
@@ -424,7 +424,8 @@ get_attendee_list_from_soap_parameter (SoupSoapParameter *param)
attendee->role = ICAL_ROLE_OPTPARTICIPANT;
else
attendee->role = ICAL_ROLE_NONPARTICIPANT;
- }
+ }
+
list = g_slist_append (list, attendee);
}
@@ -549,19 +550,11 @@ get_e_cal_component_from_soap_parameter (SoupSoapParameter *param)
/* Property - attendee-list*/
subparam = soup_soap_parameter_get_first_child_by_name (param, "distribution");
/* FIXME what to do with 'from' data*/
-
subparam = soup_soap_parameter_get_first_child_by_name (subparam, "recipients");
if (subparam)
attendee_list = get_attendee_list_from_soap_parameter (subparam);
if (attendee_list) {
- GSList *l;
e_cal_component_set_attendee_list (comp, attendee_list);
- for (l = attendee_list; l != NULL; l = g_slist_next (l)) {
- ECalComponentAttendee *attendee;
- attendee = (ECalComponentAttendee*) l->data;
- g_free (attendee->cn);
- g_free (attendee->value);
- }
g_slist_foreach (attendee_list, (GFunc) g_free, NULL);
}
@@ -1088,9 +1081,7 @@ e_gw_connection_get_deltas (EGwConnection *cnc, ECalBackendCache *cache)
EGwConnectionStatus
e_gw_connection_send_item (EGwConnection *cnc, EGwItem *item)
{
- SoupSoapMessage *msg;
- SoupSoapResponse *response;
- EGwConnectionStatus status;
+ EGwConnectionStatus status = E_GW_CONNECTION_STATUS_UNKNOWN;
g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_CONNECTION);
g_return_val_if_fail (E_IS_GW_ITEM (item), E_GW_CONNECTION_STATUS_INVALID_OBJECT);