[evolution-ews] Prefer GSlice over heap allocation for short-lived structures
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-ews] Prefer GSlice over heap allocation for short-lived structures
- Date: Wed, 22 Jan 2020 09:18:57 +0000 (UTC)
commit c0cbb965ccff06fdea20b9c3e08519674a7cebaa
Author: Milan Crha <mcrha redhat com>
Date: Wed Jan 22 10:21:05 2020 +0100
Prefer GSlice over heap allocation for short-lived structures
It might be quicker to use GSlice than to allocate new memory on the heap,
thus let's try to benefit from it.
src/addressbook/e-book-backend-ews.c | 19 +++--
src/addressbook/ews-oab-decoder.c | 15 ++--
src/camel/camel-ews-store.c | 29 ++++----
src/configuration/e-ews-config-utils.c | 10 +--
src/configuration/e-ews-ooo-notificator.c | 12 +--
src/configuration/e-ews-search-user.c | 8 +-
src/configuration/e-ews-subscribe-foreign-folder.c | 4 +-
src/server/e-ews-connection.c | 87 +++++++++++-----------
src/server/e-ews-notification.c | 4 +-
9 files changed, 90 insertions(+), 98 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-ews.c b/src/addressbook/e-book-backend-ews.c
index e8412d3d..ac4f5b87 100644
--- a/src/addressbook/e-book-backend-ews.c
+++ b/src/addressbook/e-book-backend-ews.c
@@ -631,7 +631,7 @@ set_address (EContact *contact,
if (address && !ews_address_is_empty (address)) {
EContactAddress *addr;
- addr = g_new0 (EContactAddress, 1);
+ addr = e_contact_address_new ();
copy_ews_address_to_contact_address (addr, address);
e_contact_set (contact, field, addr);
e_contact_address_free (addr);
@@ -1357,7 +1357,7 @@ compare_address (ESoapMessage *message,
if (!new_address && old_address)
{
set = TRUE;
- new_address = g_new0 (EContactAddress, 1);
+ new_address = e_contact_address_new ();
}
if (set || g_strcmp0 (new_address->street, old_address->street) != 0)
@@ -2823,21 +2823,21 @@ ebb_ews_build_restriction (const gchar *query,
gchar **auto_comp_str)
{
ESExp *sexp;
- EBookBackendEwsSExpData *sdata;
+ EBookBackendEwsSExpData sdata;
gboolean autocompletion = FALSE;
gint i;
*auto_comp_str = NULL;
sexp = e_sexp_new ();
- sdata = g_new0 (EBookBackendEwsSExpData, 1);
- sdata->is_autocompletion = FALSE;
+ memset (&sdata, 0, sizeof (EBookBackendEwsSExpData));
+ sdata.is_autocompletion = FALSE;
for (i = 0; i < G_N_ELEMENTS (symbols); i++) {
e_sexp_add_function (
sexp, 0, (gchar *) symbols[i].name,
symbols[i].func,
- sdata);
+ &sdata);
}
e_sexp_input_text (sexp, query, strlen (query));
@@ -2850,18 +2850,17 @@ ebb_ews_build_restriction (const gchar *query,
r = e_sexp_eval (sexp);
if (r) {
- autocompletion = sdata->is_autocompletion;
+ autocompletion = sdata.is_autocompletion;
if (autocompletion)
- *auto_comp_str = sdata->auto_comp_str;
+ *auto_comp_str = sdata.auto_comp_str;
else
- g_free (sdata->auto_comp_str);
+ g_free (sdata.auto_comp_str);
}
e_sexp_result_free (sexp, r);
}
g_object_unref (sexp);
- g_free (sdata);
return autocompletion && *auto_comp_str;
}
diff --git a/src/addressbook/ews-oab-decoder.c b/src/addressbook/ews-oab-decoder.c
index baa8628e..589625d0 100644
--- a/src/addressbook/ews-oab-decoder.c
+++ b/src/addressbook/ews-oab-decoder.c
@@ -91,7 +91,7 @@ ews_deffered_populate_physical_address (EwsDeferredSet *dset,
gchar *val = g_strdup ((gchar *) value);
if (!dset->addr)
- dset->addr = g_new0 (EContactAddress, 1);
+ dset->addr = e_contact_address_new ();
switch (prop_id) {
case EWS_PT_STREET_ADDRESS:
@@ -179,7 +179,6 @@ ews_populate_photo (EContact *contact,
EwsOabDecoderPrivate *priv = GET_PRIVATE (eod);
const gchar *at;
GBytes *bytes = value;
- EContactPhoto *photo;
gchar *email;
gchar *filename = NULL, *pic_name = NULL, *name;
gboolean success = TRUE;
@@ -194,8 +193,6 @@ ews_populate_photo (EContact *contact,
return;
}
- photo = g_new0 (EContactPhoto, 1);
-
/* Rename the binary file to name.jpg */
at = strchr (email, '@');
name = g_strndup (email, at - email);
@@ -206,17 +203,19 @@ ews_populate_photo (EContact *contact,
success = g_file_set_contents (filename, g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes),
&local_error);
if (success) {
- photo->type = E_CONTACT_PHOTO_TYPE_URI;
- photo->data.uri = filename;
+ EContactPhoto photo;
+
+ memset (&photo, 0, sizeof (EContactPhoto));
+ photo.type = E_CONTACT_PHOTO_TYPE_URI;
+ photo.data.uri = filename;
- e_contact_set (contact, field, photo);
+ e_contact_set (contact, field, &photo);
} else {
g_warning ("%s: Failed to store '%s': %s", G_STRFUNC, filename, local_error ?
local_error->message : "Unknown error");
}
g_clear_error (&local_error);
- g_free (photo);
g_free (email);
g_free (name);
g_free (pic_name);
diff --git a/src/camel/camel-ews-store.c b/src/camel/camel-ews-store.c
index d97845ee..98fdfab8 100644
--- a/src/camel/camel-ews-store.c
+++ b/src/camel/camel-ews-store.c
@@ -754,7 +754,7 @@ free_schedule_update_data (gpointer ptr)
g_clear_object (&sud->cancellable);
g_clear_object (&sud->ews_store);
- g_free (sud);
+ g_slice_free (struct ScheduleUpdateData, sud);
}
static GHashTable * /* gchar *id ~> gchar *change_key */
@@ -1056,7 +1056,7 @@ run_update_thread (CamelEwsStore *ews_store,
g_return_if_fail (ews_store != NULL);
g_return_if_fail (cancellable != NULL);
- sud = g_new0 (struct ScheduleUpdateData, 1);
+ sud = g_slice_new0 (struct ScheduleUpdateData);
sud->ews_store = g_object_ref (ews_store);
sud->cancellable = g_object_ref (cancellable);
@@ -1124,7 +1124,7 @@ schedule_folder_update (CamelEwsStore *ews_store,
if (ews_store->priv->update_folder_names == NULL)
goto exit;
- sud = g_new0 (struct ScheduleUpdateData, 1);
+ sud = g_slice_new0 (struct ScheduleUpdateData);
sud->ews_store = g_object_ref (ews_store);
sud->cancellable = g_object_ref (ews_store->priv->updates_cancellable);
@@ -1188,7 +1188,7 @@ schedule_folder_list_update (CamelEwsStore *ews_store)
if (!ews_store->priv->updates_cancellable)
goto exit;
- sud = g_new0 (struct ScheduleUpdateData, 1);
+ sud = g_slice_new0 (struct ScheduleUpdateData);
sud->ews_store = g_object_ref (ews_store);
sud->cancellable = g_object_ref (ews_store->priv->updates_cancellable);
@@ -1289,7 +1289,7 @@ handle_notifications_data_free (struct HandleNotificationsData *hnd)
g_object_unref (hnd->ews_store);
g_slist_free_full (hnd->folders, g_free);
- g_free (hnd);
+ g_slice_free (struct HandleNotificationsData, hnd);
}
static gpointer
@@ -1373,7 +1373,7 @@ camel_ews_store_handle_notifications (CamelEwsStore *ews_store,
return;
}
- hnd = g_new0 (struct HandleNotificationsData, 1);
+ hnd = g_slice_new0 (struct HandleNotificationsData);
hnd->ews_store = g_object_ref (ews_store);
if (!camel_ews_settings_get_check_all (ews_settings)) {
@@ -1754,7 +1754,7 @@ ews_update_foreign_subfolders_data_free (gpointer data)
if (euf) {
g_object_unref (euf->ews_store);
g_free (euf->folder_id);
- g_free (euf);
+ g_slice_free (struct EwsUpdateForeignSubfoldersData, euf);
}
}
@@ -1913,7 +1913,7 @@ camel_ews_store_update_foreign_subfolders (CamelEwsStore *ews_store,
session = camel_service_ref_session (CAMEL_SERVICE (ews_store));
g_return_if_fail (session != NULL);
- euf = g_new0 (struct EwsUpdateForeignSubfoldersData, 1);
+ euf = g_slice_new0 (struct EwsUpdateForeignSubfoldersData);
euf->ews_store = g_object_ref (ews_store);
euf->folder_id = g_strdup (fid);
@@ -3223,7 +3223,7 @@ ews_rename_folder_sync (CamelStore *store,
if (strcmp (old_slash, new_slash)) {
gint parent_len = old_slash - old_name;
- struct _rename_cb_data *rename_data;
+ struct _rename_cb_data rename_data;
/* Folder basename changed (i.e. UpdateFolder needed).
* Therefore, we can only do it if the folder hasn't also
@@ -3248,21 +3248,18 @@ ews_rename_folder_sync (CamelStore *store,
goto out;
}
- rename_data = g_new0 (struct _rename_cb_data, 1);
- rename_data->display_name = new_slash;
- rename_data->folder_id = fid;
- rename_data->change_key = changekey;
+ rename_data.display_name = new_slash;
+ rename_data.folder_id = fid;
+ rename_data.change_key = changekey;
res = e_ews_connection_update_folder_sync (
connection, EWS_PRIORITY_MEDIUM,
- rename_folder_cb, rename_data,
+ rename_folder_cb, &rename_data,
cancellable, &local_error);
if (!res) {
- g_free (rename_data);
goto out;
}
- g_free (rename_data);
camel_ews_store_summary_set_folder_name (ews_summary, fid, new_slash);
} else {
gchar *pfid = NULL;
diff --git a/src/configuration/e-ews-config-utils.c b/src/configuration/e-ews-config-utils.c
index f740f586..f95b26b6 100644
--- a/src/configuration/e-ews-config-utils.c
+++ b/src/configuration/e-ews-config-utils.c
@@ -82,7 +82,7 @@ free_run_with_feedback_data (gpointer ptr)
g_clear_error (&rfd->error);
- g_free (rfd);
+ g_slice_free (struct RunWithFeedbackData, rfd);
}
static gboolean
@@ -193,7 +193,7 @@ e_ews_config_utils_run_in_thread_with_feedback_general (GtkWindow *parent,
gtk_container_add (GTK_CONTAINER (content), box);
gtk_container_set_border_width (GTK_CONTAINER (content), 12);
- rfd = g_new0 (struct RunWithFeedbackData, 1);
+ rfd = g_slice_new0 (struct RunWithFeedbackData);
rfd->parent = parent;
rfd->dialog = dialog;
rfd->cancellable = g_cancellable_new ();
@@ -269,7 +269,7 @@ e_ews_config_utils_run_in_thread (GObject *with_object,
g_return_if_fail (with_object != NULL);
g_return_if_fail (thread_func != NULL);
- rfd = g_new0 (struct RunWithFeedbackData, 1);
+ rfd = g_slice_new0 (struct RunWithFeedbackData);
rfd->parent = NULL;
rfd->dialog = NULL;
rfd->cancellable = cancellable ? g_object_ref (cancellable) : g_cancellable_new ();
@@ -641,7 +641,7 @@ cleanup:
g_object_unref (fsd->ews_store);
g_object_unref (fsd->cancellable);
g_clear_error (&fsd->error);
- g_free (fsd);
+ g_slice_free (FolderSizeDialogData, fsd);
return FALSE;
}
@@ -759,7 +759,7 @@ e_ews_config_utils_run_folder_sizes_dialog (GtkWindow *parent,
g_signal_connect (dialog, "response", G_CALLBACK (folder_sizes_dialog_response_cb), cancellable);
- fsd = g_new0 (FolderSizeDialogData, 1);
+ fsd = g_slice_new0 (FolderSizeDialogData);
fsd->dialog = GTK_DIALOG (dialog);
gtk_window_set_default_size (GTK_WINDOW (fsd->dialog), 250, 300);
diff --git a/src/configuration/e-ews-ooo-notificator.c b/src/configuration/e-ews-ooo-notificator.c
index 4db83a36..a6389ebc 100644
--- a/src/configuration/e-ews-ooo-notificator.c
+++ b/src/configuration/e-ews-ooo-notificator.c
@@ -88,7 +88,7 @@ e_ews_ooo_notificator_dispatcher_data_free (gpointer user_data)
g_object_unref (data->extension);
if (data->ews_store)
g_object_unref (data->ews_store);
- g_free (data);
+ g_slice_free (EEwsOooNotificatorDispatcherData, data);
}
static void
@@ -162,7 +162,7 @@ e_ews_ooo_notificator_show_notification (EEwsOooNotificator *extension,
GtkAction *action;
const gchar *account_name;
- data = g_new0 (EEwsOooNotificatorDispatcherData, 1);
+ data = g_slice_new0 (EEwsOooNotificatorDispatcherData);
data->extension = g_object_ref (extension);
data->ews_store = g_object_ref (ews_store);
@@ -267,7 +267,7 @@ e_ews_ooo_notificator_has_ooo_set_cb (EEwsOooNotificator *extension,
{
EEwsOooNotificatorDispatcherData *data;
- data = g_new0 (EEwsOooNotificatorDispatcherData, 1);
+ data = g_slice_new0 (EEwsOooNotificatorDispatcherData);
data->extension = g_object_ref (extension);
data->ews_store = g_object_ref (ews_store);
@@ -288,7 +288,7 @@ e_ews_ooo_notificator_service_disabled_cb (EEwsOooNotificator *extension,
if (!CAMEL_IS_EWS_STORE (service))
return;
- data = g_new0 (EEwsOooNotificatorDispatcherData, 1);
+ data = g_slice_new0 (EEwsOooNotificatorDispatcherData);
data->extension = g_object_ref (extension);
data->ews_store = g_object_ref (CAMEL_EWS_STORE (service));
@@ -308,7 +308,7 @@ e_ews_ooo_notificator_service_removed_cb (EEwsOooNotificator *extension,
if (!CAMEL_IS_EWS_STORE (service))
return;
- data = g_new0 (EEwsOooNotificatorDispatcherData, 1);
+ data = g_slice_new0 (EEwsOooNotificatorDispatcherData);
data->extension = g_object_ref (extension);
data->ews_store = g_object_ref (CAMEL_EWS_STORE (service));
@@ -348,7 +348,7 @@ e_ews_ooo_notificator_online_cb (EEwsOooNotificator* extension,
for (l = extension->priv->stores; l; l = l->next) {
EEwsOooNotificatorDispatcherData *data;
- data = g_new0 (EEwsOooNotificatorDispatcherData, 1);
+ data = g_slice_new0 (EEwsOooNotificatorDispatcherData);
data->extension = g_object_ref (extension);
data->ews_store = g_object_ref (CAMEL_EWS_STORE (l->data));
diff --git a/src/configuration/e-ews-search-user.c b/src/configuration/e-ews-search-user.c
index 4c20fb89..52c92a59 100644
--- a/src/configuration/e-ews-search-user.c
+++ b/src/configuration/e-ews-search-user.c
@@ -65,7 +65,7 @@ e_ews_search_user_data_free (gpointer ptr)
}
g_object_unref (pgu->conn);
g_free (pgu->search_text);
- g_free (pgu);
+ g_slice_free (struct EEwsSearchUserData, pgu);
}
struct EEwsSearchUser
@@ -127,7 +127,7 @@ e_ews_search_idle_data_free (gpointer ptr)
g_object_unref (sid->cancellable);
g_free (sid->search_text);
g_slist_free_full (sid->found_users, e_ews_search_user_free);
- g_free (sid);
+ g_slice_free (struct EEwsSearchIdleData, sid);
}
static void
@@ -356,7 +356,7 @@ search_term_changed_cb (GtkEntry *entry,
} else {
struct EEwsSearchIdleData *sid;
- sid = g_new0 (struct EEwsSearchIdleData, 1);
+ sid = g_slice_new0 (struct EEwsSearchIdleData);
sid->cancellable = g_object_ref (pgu->cancellable);
sid->dialog = dialog;
@@ -467,7 +467,7 @@ e_ews_search_user_modal (GtkWindow *parent,
g_return_val_if_fail (conn != NULL, FALSE);
g_return_val_if_fail (display_name || email, FALSE);
- pgu = g_new0 (struct EEwsSearchUserData, 1);
+ pgu = g_slice_new0 (struct EEwsSearchUserData);
pgu->conn = g_object_ref (conn);
dialog = gtk_dialog_new_with_buttons (
diff --git a/src/configuration/e-ews-subscribe-foreign-folder.c
b/src/configuration/e-ews-subscribe-foreign-folder.c
index a692c578..ef04c999 100644
--- a/src/configuration/e-ews-subscribe-foreign-folder.c
+++ b/src/configuration/e-ews-subscribe-foreign-folder.c
@@ -251,7 +251,7 @@ e_ews_check_foreign_folder_data_free (gpointer ptr)
if (cffd->folder)
g_object_unref (cffd->folder);
- g_free (cffd);
+ g_slice_free (struct EEwsCheckForeignFolderData, cffd);
}
static void
@@ -597,7 +597,7 @@ subscribe_foreign_response_cb (GObject *dialog,
show_foldername = g_strdup_printf ("%.10s…", orig_foldername);
}
- cffd = g_new0 (struct EEwsCheckForeignFolderData, 1);
+ cffd = g_slice_new0 (struct EEwsCheckForeignFolderData);
cffd->dialog = GTK_WIDGET (dialog);
cffd->email = g_strdup (username ? username : "");
cffd->direct_email = g_strdup (g_object_get_data (G_OBJECT (entry), STR_EWS_DIRECT_EMAIL));
diff --git a/src/server/e-ews-connection.c b/src/server/e-ews-connection.c
index 68ff196f..c6f40827 100644
--- a/src/server/e-ews-connection.c
+++ b/src/server/e-ews-connection.c
@@ -231,7 +231,7 @@ static void
async_data_free (EwsAsyncData *async_data)
{
g_free (async_data->custom_data);
- g_free (async_data);
+ g_slice_free (EwsAsyncData, async_data);
}
EEwsNotificationEvent *
@@ -464,12 +464,9 @@ e_ews_additional_props_free (EEwsAdditionalProps *add_props)
}
static EwsNode *
-ews_node_new ()
+ews_node_new (void)
{
- EwsNode *node;
-
- node = g_new0 (EwsNode, 1);
- return node;
+ return g_slice_new0 (EwsNode);
}
static void
@@ -604,7 +601,7 @@ ews_connection_scheduled_cb (gpointer user_data)
g_object_unref (sd->message);
/* in case this is the last reference */
e_ews_connection_utils_unref_in_thread (sd->cnc);
- g_free (sd);
+ g_slice_free (EwsScheduleData, sd);
return FALSE;
}
@@ -621,7 +618,7 @@ ews_connection_schedule_queue_message (EEwsConnection *cnc,
g_return_if_fail (E_IS_EWS_CONNECTION (cnc));
g_return_if_fail (SOUP_IS_MESSAGE (message));
- sd = g_new0 (EwsScheduleData, 1);
+ sd = g_slice_new0 (EwsScheduleData);
sd->cnc = g_object_ref (cnc);
sd->message = g_object_ref (message);
sd->op = EWS_SCHEDULE_OP_QUEUE_MESSAGE;
@@ -645,7 +642,7 @@ ews_connection_schedule_cancel_message (EEwsConnection *cnc,
g_return_if_fail (E_IS_EWS_CONNECTION (cnc));
g_return_if_fail (SOUP_IS_MESSAGE (message));
- sd = g_new0 (EwsScheduleData, 1);
+ sd = g_slice_new0 (EwsScheduleData);
sd->cnc = g_object_ref (cnc);
sd->message = g_object_ref (message);
sd->op = EWS_SCHEDULE_OP_CANCEL;
@@ -665,7 +662,7 @@ ews_connection_schedule_abort (EEwsConnection *cnc)
g_return_if_fail (E_IS_EWS_CONNECTION (cnc));
- sd = g_new0 (EwsScheduleData, 1);
+ sd = g_slice_new0 (EwsScheduleData);
sd->cnc = g_object_ref (cnc);
sd->op = EWS_SCHEDULE_OP_ABORT;
@@ -802,7 +799,7 @@ ews_active_job_done (EEwsConnection *cnc,
e_ews_connection_utils_unref_in_thread (ews_node->simple);
}
- g_free (ews_node);
+ g_slice_free (EwsNode, ews_node);
}
static void
@@ -4752,7 +4749,7 @@ e_ews_connection_sync_folder_items (EEwsConnection *cnc,
G_OBJECT (cnc), callback, user_data,
e_ews_connection_sync_folder_items);
- async_data = g_new0 (EwsAsyncData, 1);
+ async_data = g_slice_new0 (EwsAsyncData);
g_simple_async_result_set_op_res_gpointer (
simple, async_data, (GDestroyNotify) async_data_free);
@@ -4969,7 +4966,7 @@ e_ews_connection_find_folder_items (EEwsConnection *cnc,
G_OBJECT (cnc), callback, user_data,
e_ews_connection_find_folder_items);
- async_data = g_new0 (EwsAsyncData, 1);
+ async_data = g_slice_new0 (EwsAsyncData);
g_simple_async_result_set_op_res_gpointer (
simple, async_data, (GDestroyNotify) async_data_free);
@@ -5086,7 +5083,7 @@ e_ews_connection_sync_folder_hierarchy (EEwsConnection *cnc,
G_OBJECT (cnc), callback, user_data,
e_ews_connection_sync_folder_hierarchy);
- async_data = g_new0 (EwsAsyncData, 1);
+ async_data = g_slice_new0 (EwsAsyncData);
async_data->cnc = cnc;
g_simple_async_result_set_op_res_gpointer (
simple, async_data, (GDestroyNotify) async_data_free);
@@ -5307,7 +5304,7 @@ e_ews_connection_get_items (EEwsConnection *cnc,
G_OBJECT (cnc), callback, user_data,
e_ews_connection_get_items);
- async_data = g_new0 (EwsAsyncData, 1);
+ async_data = g_slice_new0 (EwsAsyncData);
g_simple_async_result_set_op_res_gpointer (
simple, async_data, (GDestroyNotify) async_data_free);
@@ -5517,7 +5514,7 @@ e_ews_connection_delete_items (EEwsConnection *cnc,
G_OBJECT (cnc), callback, user_data,
e_ews_connection_delete_items);
- async_data = g_new0 (EwsAsyncData, 1);
+ async_data = g_slice_new0 (EwsAsyncData);
g_simple_async_result_set_op_res_gpointer (
simple, async_data, (GDestroyNotify) async_data_free);
@@ -5595,7 +5592,7 @@ e_ews_connection_delete_item (EEwsConnection *cnc,
G_OBJECT (cnc), callback, user_data,
e_ews_connection_delete_items);
- async_data = g_new0 (EwsAsyncData, 1);
+ async_data = g_slice_new0 (EwsAsyncData);
g_simple_async_result_set_op_res_gpointer (
simple, async_data, (GDestroyNotify) async_data_free);
@@ -5901,7 +5898,7 @@ e_ews_connection_update_items (EEwsConnection *cnc,
G_OBJECT (cnc), callback, user_data,
e_ews_connection_update_items);
- async_data = g_new0 (EwsAsyncData, 1);
+ async_data = g_slice_new0 (EwsAsyncData);
g_simple_async_result_set_op_res_gpointer (
simple, async_data, (GDestroyNotify) async_data_free);
@@ -6070,7 +6067,7 @@ e_ews_connection_create_items (EEwsConnection *cnc,
G_OBJECT (cnc), callback, user_data,
e_ews_connection_create_items);
- async_data = g_new0 (EwsAsyncData, 1);
+ async_data = g_slice_new0 (EwsAsyncData);
g_simple_async_result_set_op_res_gpointer (
simple, async_data, (GDestroyNotify) async_data_free);
@@ -6235,7 +6232,7 @@ e_ews_connection_resolve_names (EEwsConnection *cnc,
G_OBJECT (cnc), callback, user_data,
e_ews_connection_resolve_names);
- async_data = g_new0 (EwsAsyncData, 1);
+ async_data = g_slice_new0 (EwsAsyncData);
g_simple_async_result_set_op_res_gpointer (
simple, async_data, (GDestroyNotify) async_data_free);
@@ -6532,7 +6529,7 @@ e_ews_connection_expand_dl (EEwsConnection *cnc,
G_OBJECT (cnc), callback, user_data,
e_ews_connection_expand_dl);
- async_data = g_new0 (EwsAsyncData, 1);
+ async_data = g_slice_new0 (EwsAsyncData);
g_simple_async_result_set_op_res_gpointer (
simple, async_data, (GDestroyNotify) async_data_free);
@@ -6679,7 +6676,7 @@ e_ews_connection_update_folder (EEwsConnection *cnc,
G_OBJECT (cnc), callback, user_data,
e_ews_connection_update_folder);
- async_data = g_new0 (EwsAsyncData, 1);
+ async_data = g_slice_new0 (EwsAsyncData);
g_simple_async_result_set_op_res_gpointer (
simple, async_data, (GDestroyNotify) async_data_free);
@@ -6831,7 +6828,7 @@ e_ews_connection_move_folder (EEwsConnection *cnc,
G_OBJECT (cnc), callback, user_data,
e_ews_connection_move_folder);
- async_data = g_new0 (EwsAsyncData, 1);
+ async_data = g_slice_new0 (EwsAsyncData);
g_simple_async_result_set_op_res_gpointer (
simple, async_data, (GDestroyNotify) async_data_free);
@@ -6938,7 +6935,7 @@ e_ews_connection_get_folder (EEwsConnection *cnc,
G_OBJECT (cnc), callback, user_data,
e_ews_connection_get_folder);
- async_data = g_new0 (EwsAsyncData, 1);
+ async_data = g_slice_new0 (EwsAsyncData);
async_data->cnc = cnc;
g_simple_async_result_set_op_res_gpointer (
simple, async_data, (GDestroyNotify) async_data_free);
@@ -7097,7 +7094,7 @@ e_ews_connection_create_folder (EEwsConnection *cnc,
G_OBJECT (cnc), callback, user_data,
e_ews_connection_create_folder);
- async_data = g_new0 (EwsAsyncData, 1);
+ async_data = g_slice_new0 (EwsAsyncData);
async_data->folder_type = folder_type;
g_simple_async_result_set_op_res_gpointer (
@@ -7231,7 +7228,7 @@ e_ews_connection_move_items (EEwsConnection *cnc,
G_OBJECT (cnc), callback, user_data,
e_ews_connection_move_items);
- async_data = g_new0 (EwsAsyncData, 1);
+ async_data = g_slice_new0 (EwsAsyncData);
g_simple_async_result_set_op_res_gpointer (
simple, async_data, (GDestroyNotify) async_data_free);
@@ -7483,7 +7480,7 @@ e_ews_connection_delete_folder (EEwsConnection *cnc,
G_OBJECT (cnc), callback, user_data,
e_ews_connection_delete_folder);
- async_data = g_new0 (EwsAsyncData, 1);
+ async_data = g_slice_new0 (EwsAsyncData);
g_simple_async_result_set_op_res_gpointer (
simple, async_data, (GDestroyNotify) async_data_free);
@@ -7649,7 +7646,7 @@ e_ews_connection_empty_folder (EEwsConnection *cnc,
G_OBJECT (cnc), callback, user_data,
e_ews_connection_empty_folder);
- async_data = g_new0 (EwsAsyncData, 1);
+ async_data = g_slice_new0 (EwsAsyncData);
g_simple_async_result_set_op_res_gpointer (
simple, async_data, (GDestroyNotify) async_data_free);
@@ -7873,7 +7870,7 @@ e_ews_connection_create_attachments (EEwsConnection *cnc,
G_OBJECT (cnc), callback, user_data,
e_ews_connection_create_attachments);
- async_data = g_new0 (EwsAsyncData, 1);
+ async_data = g_slice_new0 (EwsAsyncData);
g_simple_async_result_set_op_res_gpointer (
simple, async_data, (GDestroyNotify) async_data_free);
@@ -8088,7 +8085,7 @@ e_ews_connection_delete_attachments (EEwsConnection *cnc,
G_OBJECT (cnc), callback, user_data,
e_ews_connection_delete_attachments);
- async_data = g_new0 (EwsAsyncData, 1);
+ async_data = g_slice_new0 (EwsAsyncData);
g_simple_async_result_set_op_res_gpointer (
simple, async_data, (GDestroyNotify) async_data_free);
@@ -8290,7 +8287,7 @@ e_ews_connection_get_attachments (EEwsConnection *cnc,
G_OBJECT (cnc), callback, user_data,
e_ews_connection_get_attachments);
- async_data = g_new0 (EwsAsyncData, 1);
+ async_data = g_slice_new0 (EwsAsyncData);
async_data->directory = cache;
async_data->sync_state = (gchar *) uid;
g_simple_async_result_set_op_res_gpointer (
@@ -8573,7 +8570,7 @@ e_ews_connection_get_free_busy (EEwsConnection *cnc,
G_OBJECT (cnc), callback, user_data,
e_ews_connection_get_free_busy);
- async_data = g_new0 (EwsAsyncData, 1);
+ async_data = g_slice_new0 (EwsAsyncData);
g_simple_async_result_set_op_res_gpointer (
simple, async_data, (GDestroyNotify) async_data_free);
@@ -8861,7 +8858,7 @@ e_ews_connection_get_delegate (EEwsConnection *cnc,
G_OBJECT (cnc), callback, user_data,
e_ews_connection_get_delegate);
- async_data = g_new0 (EwsAsyncData, 1);
+ async_data = g_slice_new0 (EwsAsyncData);
g_simple_async_result_set_op_res_gpointer (
simple, async_data, (GDestroyNotify) async_data_free);
@@ -9072,7 +9069,7 @@ e_ews_connection_add_delegate (EEwsConnection *cnc,
G_OBJECT (cnc), callback, user_data,
e_ews_connection_add_delegate);
- async_data = g_new0 (EwsAsyncData, 1);
+ async_data = g_slice_new0 (EwsAsyncData);
g_simple_async_result_set_op_res_gpointer (
simple, async_data, (GDestroyNotify) async_data_free);
@@ -9184,7 +9181,7 @@ e_ews_connection_remove_delegate (EEwsConnection *cnc,
G_OBJECT (cnc), callback, user_data,
e_ews_connection_remove_delegate);
- async_data = g_new0 (EwsAsyncData, 1);
+ async_data = g_slice_new0 (EwsAsyncData);
g_simple_async_result_set_op_res_gpointer (
simple, async_data, (GDestroyNotify) async_data_free);
@@ -9324,7 +9321,7 @@ e_ews_connection_update_delegate (EEwsConnection *cnc,
G_OBJECT (cnc), callback, user_data,
e_ews_connection_update_delegate);
- async_data = g_new0 (EwsAsyncData, 1);
+ async_data = g_slice_new0 (EwsAsyncData);
g_simple_async_result_set_op_res_gpointer (
simple, async_data, (GDestroyNotify) async_data_free);
@@ -9484,7 +9481,7 @@ e_ews_connection_get_folder_permissions (EEwsConnection *cnc,
G_OBJECT (cnc), callback, user_data,
e_ews_connection_get_folder_permissions);
- async_data = g_new0 (EwsAsyncData, 1);
+ async_data = g_slice_new0 (EwsAsyncData);
g_simple_async_result_set_op_res_gpointer (
simple, async_data, (GDestroyNotify) async_data_free);
@@ -9710,7 +9707,7 @@ e_ews_connection_set_folder_permissions (EEwsConnection *cnc,
G_OBJECT (cnc), callback, user_data,
e_ews_connection_set_folder_permissions);
- async_data = g_new0 (EwsAsyncData, 1);
+ async_data = g_slice_new0 (EwsAsyncData);
g_simple_async_result_set_op_res_gpointer (
simple, async_data, (GDestroyNotify) async_data_free);
@@ -9840,7 +9837,7 @@ e_ews_connection_get_password_expiration (EEwsConnection *cnc,
G_OBJECT (cnc), callback, user_data,
e_ews_connection_get_password_expiration);
- async_data = g_new0 (EwsAsyncData, 1);
+ async_data = g_slice_new0 (EwsAsyncData);
g_simple_async_result_set_op_res_gpointer (
simple, async_data, (GDestroyNotify) async_data_free);
@@ -10017,7 +10014,7 @@ e_ews_connection_get_folder_info (EEwsConnection *cnc,
G_OBJECT (cnc), callback, user_data,
e_ews_connection_get_folder_info);
- async_data = g_new0 (EwsAsyncData, 1);
+ async_data = g_slice_new0 (EwsAsyncData);
g_simple_async_result_set_op_res_gpointer (
simple, async_data, (GDestroyNotify) async_data_free);
@@ -10218,7 +10215,7 @@ e_ews_connection_find_folder (EEwsConnection *cnc,
G_OBJECT (cnc), callback, user_data,
e_ews_connection_find_folder);
- async_data = g_new0 (EwsAsyncData, 1);
+ async_data = g_slice_new0 (EwsAsyncData);
g_simple_async_result_set_op_res_gpointer (
simple, async_data, (GDestroyNotify) async_data_free);
@@ -10405,7 +10402,7 @@ e_ews_connection_query_auth_methods (EEwsConnection *cnc,
G_OBJECT (cnc), callback, user_data,
e_ews_connection_query_auth_methods);
- async_data = g_new0 (EwsAsyncData, 1);
+ async_data = g_slice_new0 (EwsAsyncData);
g_simple_async_result_set_op_res_gpointer (
simple, async_data, (GDestroyNotify) async_data_free);
@@ -11145,7 +11142,7 @@ e_ews_connection_get_server_time_zones (EEwsConnection *cnc,
simple = g_simple_async_result_new (
G_OBJECT (cnc), callback, user_data, e_ews_connection_get_server_time_zones);
- async_data = g_new0 (EwsAsyncData, 1);
+ async_data = g_slice_new0 (EwsAsyncData);
g_simple_async_result_set_op_res_gpointer (simple, async_data, (GDestroyNotify) async_data_free);
/*
@@ -11292,7 +11289,7 @@ e_ews_connection_get_user_photo (EEwsConnection *cnc,
g_return_if_fail (email != NULL);
simple = g_simple_async_result_new (G_OBJECT (cnc), callback, user_data,
e_ews_connection_get_user_photo);
- async_data = g_new0 (EwsAsyncData, 1);
+ async_data = g_slice_new0 (EwsAsyncData);
g_simple_async_result_set_op_res_gpointer (simple, async_data, (GDestroyNotify) async_data_free);
/*
@@ -11493,7 +11490,7 @@ e_ews_connection_get_user_configuration (EEwsConnection *cnc,
g_return_if_fail (config_name != NULL);
simple = g_simple_async_result_new (G_OBJECT (cnc), callback, user_data,
e_ews_connection_get_user_configuration);
- async_data = g_new0 (EwsAsyncData, 1);
+ async_data = g_slice_new0 (EwsAsyncData);
g_simple_async_result_set_op_res_gpointer (simple, async_data, (GDestroyNotify) async_data_free);
/* EWS server version earlier than 2010 doesn't support it. */
diff --git a/src/server/e-ews-notification.c b/src/server/e-ews-notification.c
index 3bf6cc1e..c2d03df1 100644
--- a/src/server/e-ews-notification.c
+++ b/src/server/e-ews-notification.c
@@ -855,7 +855,7 @@ exit:
g_slist_free_full (td->folders, g_free);
g_object_unref (td->cancellable);
g_object_unref (td->notification);
- g_free (td);
+ g_slice_free (EEwsNotificationThreadData, td);
return NULL;
}
@@ -877,7 +877,7 @@ e_ews_notification_start_listening_sync (EEwsNotification *notification,
notification->priv->cancellable = g_cancellable_new ();
- td = g_new0 (EEwsNotificationThreadData, 1);
+ td = g_slice_new0 (EEwsNotificationThreadData);
td->notification = g_object_ref (notification);
td->cancellable = g_object_ref (notification->priv->cancellable);
for (l = folders; l != NULL; l = l->next)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]