don't allocate memory for ECalComponentAttendee's fields, make them just
authorRodrigo Moya <rodrigo@ximian.com>
Mon, 26 Jan 2004 15:12:33 +0000 (15:12 +0000)
committerRodrigo Moya <rodrigo@src.gnome.org>
Mon, 26 Jan 2004 15:12:33 +0000 (15:12 +0000)
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.

calendar/ChangeLog
calendar/backends/groupwise/e-cal-backend-groupwise.c
calendar/backends/groupwise/e-gw-connection.c
servers/groupwise/e-gw-connection.c

index 8af6da0..c71e358 100644 (file)
@@ -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
index ef17d96..70f5f2a 100644 (file)
@@ -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 ();
index 0ce2ce9..2616a54 100644 (file)
@@ -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);
index 0ce2ce9..2616a54 100644 (file)
@@ -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);