From b3d3f4f291f74e6f39111f48bb891598b5ee5c18 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Tue, 22 May 2007 16:18:32 +0000 Subject: [PATCH] app/widgets/gimpcontrollers.c app/widgets/gimpdevices.c 2007-05-22 Sven Neumann * app/widgets/gimpcontrollers.c * app/widgets/gimpdevices.c * app/widgets/gimpdevicestatus.c * app/widgets/gimpeditor.c: allocate structs using GSlice. svn path=/trunk/; revision=22575 --- ChangeLog | 7 +++++++ app/widgets/gimpcontrollers.c | 4 ++-- app/widgets/gimpdevices.c | 4 ++-- app/widgets/gimpdevicestatus.c | 8 +++++--- app/widgets/gimpeditor.c | 17 ++++++++++------- 5 files changed, 26 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5830b8f0f3..5d2f2f0878 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-05-22 Sven Neumann + + * app/widgets/gimpcontrollers.c + * app/widgets/gimpdevices.c + * app/widgets/gimpdevicestatus.c + * app/widgets/gimpeditor.c: allocate structs using GSlice. + 2007-05-22 Sven Neumann * app/widgets/gimpmenufactory.c diff --git a/app/widgets/gimpcontrollers.c b/app/widgets/gimpcontrollers.c index a5e6741e3d..7408358d11 100644 --- a/app/widgets/gimpcontrollers.c +++ b/app/widgets/gimpcontrollers.c @@ -86,7 +86,7 @@ gimp_controllers_init (Gimp *gimp) g_return_if_fail (GIMP_IS_GIMP (gimp)); g_return_if_fail (gimp_controller_manager_get (gimp) == NULL); - manager = g_new0 (GimpControllerManager, 1); + manager = g_slice_new0 (GimpControllerManager); g_object_set_data_full (G_OBJECT (gimp), GIMP_CONTROLLER_MANAGER_DATA_KEY, manager, @@ -287,7 +287,7 @@ gimp_controller_manager_free (GimpControllerManager *manager) g_object_unref (manager->controllers); g_object_unref (manager->ui_manager); - g_free (manager); + g_slice_free (GimpControllerManager, manager); } static void diff --git a/app/widgets/gimpdevices.c b/app/widgets/gimpdevices.c index 45dbe6fedc..a7b7228a4e 100644 --- a/app/widgets/gimpdevices.c +++ b/app/widgets/gimpdevices.c @@ -93,7 +93,7 @@ gimp_devices_init (Gimp *gimp, g_return_if_fail (GIMP_IS_GIMP (gimp)); g_return_if_fail (gimp_device_manager_get (gimp) == NULL); - manager = g_new0 (GimpDeviceManager, 1); + manager = g_slice_new0 (GimpDeviceManager); g_object_set_data_full (G_OBJECT (gimp), GIMP_DEVICE_MANAGER_DATA_KEY, manager, @@ -409,7 +409,7 @@ gimp_device_manager_free (GimpDeviceManager *manager) if (manager->device_info_list) g_object_unref (manager->device_info_list); - g_free (manager); + g_slice_free (GimpDeviceManager, manager); } static void diff --git a/app/widgets/gimpdevicestatus.c b/app/widgets/gimpdevicestatus.c index f3ad91aa36..fc35096fee 100644 --- a/app/widgets/gimpdevicestatus.c +++ b/app/widgets/gimpdevicestatus.c @@ -209,7 +209,8 @@ gimp_device_status_destroy (GtkObject *object) g_signal_handlers_disconnect_by_func (entry->device_info, gimp_device_status_update_entry, entry); - g_free (entry); + + g_slice_free (GimpDeviceStatusEntry, entry); } g_list_free (status->devices); @@ -234,7 +235,7 @@ gimp_device_status_device_add (GimpContainer *devices, if (! device_info->device) return; - entry = g_new0 (GimpDeviceStatusEntry, 1); + entry = g_slice_new0 (GimpDeviceStatusEntry); status->devices = g_list_prepend (status->devices, entry); @@ -385,7 +386,8 @@ gimp_device_status_device_remove (GimpContainer *devices, g_signal_handlers_disconnect_by_func (entry->device_info, gimp_device_status_update_entry, entry); - g_free (entry); + + g_slice_free (GimpDeviceStatusEntry, entry); return; } diff --git a/app/widgets/gimpeditor.c b/app/widgets/gimpeditor.c index ea9a74f797..e6fa1d7525 100644 --- a/app/widgets/gimpeditor.c +++ b/app/widgets/gimpeditor.c @@ -540,19 +540,22 @@ gimp_editor_add_stock_box (GimpEditor *editor, return first_button; } -typedef struct _ExtendedAction ExtendedAction; -struct _ExtendedAction +typedef struct { GdkModifierType mod_mask; GtkAction *action; -}; +} ExtendedAction; static void -gimp_editor_button_extended_actions_free (GList *list) +gimp_editor_button_extended_actions_free (GList *actions) { - g_list_foreach (list, (GFunc) g_free, NULL); - g_list_free (list); + GList *list; + + for (list = actions; list; list = list->next) + g_slice_free (ExtendedAction, list->data); + + g_list_free (actions); } static void @@ -654,7 +657,7 @@ gimp_editor_add_action_button (GimpEditor *editor, if (action && mod_mask) { - ExtendedAction *ext = g_new0 (ExtendedAction, 1); + ExtendedAction *ext = g_slice_new (ExtendedAction); ext->mod_mask = mod_mask; ext->action = action;