mirror of https://github.com/GNOME/gimp.git
app/actions/data-commands.c app/base/boundary.c app/base/gimphistogram.c
2007-05-22 Michael Natterer <mitch@gimp.org> * app/actions/data-commands.c * app/base/boundary.c * app/base/gimphistogram.c * app/base/gimplut.c * app/base/temp-buf.c * app/core/gimpcontainer.c * app/core/gimpgradient.c * app/core/gimpparamspecs.c * app/core/gimpundo.c * app/plug-in/gimpplugin-cleanup.c * app/plug-in/gimppluginmanager-data.c * app/plug-in/gimppluginmanager-help-domain.c * app/plug-in/gimppluginmanager-locale-domain.c * app/plug-in/gimppluginmanager-menu-branch.c * app/plug-in/gimppluginprocframe.c * app/vectors/gimpanchor.c * app/widgets/gimpsessioninfo.c: use GSlice instead of g_new/g_free for structs of fixed size. svn path=/trunk/; revision=22558
This commit is contained in:
parent
957db416e8
commit
ada79e533a
21
ChangeLog
21
ChangeLog
|
@ -1,3 +1,24 @@
|
|||
2007-05-22 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/actions/data-commands.c
|
||||
* app/base/boundary.c
|
||||
* app/base/gimphistogram.c
|
||||
* app/base/gimplut.c
|
||||
* app/base/temp-buf.c
|
||||
* app/core/gimpcontainer.c
|
||||
* app/core/gimpgradient.c
|
||||
* app/core/gimpparamspecs.c
|
||||
* app/core/gimpundo.c
|
||||
* app/plug-in/gimpplugin-cleanup.c
|
||||
* app/plug-in/gimppluginmanager-data.c
|
||||
* app/plug-in/gimppluginmanager-help-domain.c
|
||||
* app/plug-in/gimppluginmanager-locale-domain.c
|
||||
* app/plug-in/gimppluginmanager-menu-branch.c
|
||||
* app/plug-in/gimppluginprocframe.c
|
||||
* app/vectors/gimpanchor.c
|
||||
* app/widgets/gimpsessioninfo.c: use GSlice instead of g_new/g_free
|
||||
for structs of fixed size.
|
||||
|
||||
2007-05-22 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/widgets/gimpprogressbox.c (gimp_progress_box_progress_start)
|
||||
|
|
|
@ -220,7 +220,7 @@ data_delete_cmd_callback (GtkAction *action,
|
|||
GimpDataDeleteData *delete_data;
|
||||
GtkWidget *dialog;
|
||||
|
||||
delete_data = g_new0 (GimpDataDeleteData, 1);
|
||||
delete_data = g_slice_new0 (GimpDataDeleteData);
|
||||
|
||||
delete_data->view = view;
|
||||
delete_data->data = data;
|
||||
|
@ -326,5 +326,5 @@ data_delete_confirm_response (GtkWidget *dialog,
|
|||
}
|
||||
}
|
||||
|
||||
g_free (delete_data);
|
||||
g_slice_free (GimpDataDeleteData, delete_data);
|
||||
}
|
||||
|
|
|
@ -346,7 +346,7 @@ boundary_simplify (BoundSeg *sorted_segs,
|
|||
static Boundary *
|
||||
boundary_new (PixelRegion *PR)
|
||||
{
|
||||
Boundary *boundary = g_new0 (Boundary, 1);
|
||||
Boundary *boundary = g_slice_new0 (Boundary);
|
||||
|
||||
if (PR)
|
||||
{
|
||||
|
@ -389,7 +389,7 @@ boundary_free (Boundary *boundary,
|
|||
g_free (boundary->empty_segs_c);
|
||||
g_free (boundary->empty_segs_l);
|
||||
|
||||
g_free (boundary);
|
||||
g_slice_free (Boundary, boundary);
|
||||
|
||||
return segs;
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ static void gimp_histogram_calculate_sub_region (GimpHistogram *histogram,
|
|||
GimpHistogram *
|
||||
gimp_histogram_new (void)
|
||||
{
|
||||
GimpHistogram *histogram = g_new0 (GimpHistogram, 1);
|
||||
GimpHistogram *histogram = g_slice_new0 (GimpHistogram);
|
||||
|
||||
#ifdef ENABLE_MP
|
||||
g_static_mutex_init (&histogram->mutex);
|
||||
|
@ -81,7 +81,7 @@ gimp_histogram_free (GimpHistogram *histogram)
|
|||
g_return_if_fail (histogram != NULL);
|
||||
|
||||
gimp_histogram_free_values (histogram);
|
||||
g_free (histogram);
|
||||
g_slice_free (GimpHistogram, histogram);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -33,7 +33,7 @@ gimp_lut_new (void)
|
|||
{
|
||||
GimpLut *lut;
|
||||
|
||||
lut = g_new (GimpLut, 1);
|
||||
lut = g_slice_new (GimpLut);
|
||||
|
||||
lut->luts = NULL;
|
||||
lut->nchannels = 0;
|
||||
|
@ -50,7 +50,7 @@ gimp_lut_free (GimpLut *lut)
|
|||
g_free (lut->luts[i]);
|
||||
|
||||
g_free (lut->luts);
|
||||
g_free (lut);
|
||||
g_slice_free (GimpLut, lut);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -52,7 +52,7 @@ temp_buf_new (gint width,
|
|||
g_return_val_if_fail (width > 0 && height > 0, NULL);
|
||||
g_return_val_if_fail (bytes > 0, NULL);
|
||||
|
||||
temp = g_new (TempBuf, 1);
|
||||
temp = g_slice_new (TempBuf);
|
||||
|
||||
temp->width = width;
|
||||
temp->height = height;
|
||||
|
@ -352,7 +352,7 @@ temp_buf_free (TempBuf *temp_buf)
|
|||
if (temp_buf->data)
|
||||
g_free (temp_buf->data);
|
||||
|
||||
g_free (temp_buf);
|
||||
g_slice_free (TempBuf, temp_buf);
|
||||
}
|
||||
|
||||
guchar *
|
||||
|
|
|
@ -865,7 +865,7 @@ gimp_container_add_handler (GimpContainer *container,
|
|||
g_return_val_if_fail (g_signal_lookup (signame,
|
||||
container->children_type), 0);
|
||||
|
||||
handler = g_new0 (GimpContainerHandler, 1);
|
||||
handler = g_slice_new0 (GimpContainerHandler);
|
||||
|
||||
/* create a unique key for this handler */
|
||||
key = g_strdup_printf ("%s-%d", signame, handler_id++);
|
||||
|
@ -939,5 +939,5 @@ gimp_container_remove_handler (GimpContainer *container,
|
|||
container->handlers = g_list_remove (container->handlers, handler);
|
||||
|
||||
g_free (handler->signame);
|
||||
g_free (handler);
|
||||
g_slice_free (GimpContainerHandler, handler);
|
||||
}
|
||||
|
|
|
@ -592,7 +592,7 @@ gimp_gradient_segment_new (void)
|
|||
{
|
||||
GimpGradientSegment *seg;
|
||||
|
||||
seg = g_new (GimpGradientSegment, 1);
|
||||
seg = g_slice_new (GimpGradientSegment);
|
||||
|
||||
seg->left = 0.0;
|
||||
seg->middle = 0.5;
|
||||
|
@ -618,22 +618,15 @@ gimp_gradient_segment_free (GimpGradientSegment *seg)
|
|||
{
|
||||
g_return_if_fail (seg != NULL);
|
||||
|
||||
g_free (seg);
|
||||
g_slice_free (GimpGradientSegment, seg);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_gradient_segments_free (GimpGradientSegment *seg)
|
||||
{
|
||||
GimpGradientSegment *tmp;
|
||||
|
||||
g_return_if_fail (seg != NULL);
|
||||
|
||||
while (seg)
|
||||
{
|
||||
tmp = seg->next;
|
||||
gimp_gradient_segment_free (seg);
|
||||
seg = tmp;
|
||||
}
|
||||
g_slice_free_chain (GimpGradientSegment, seg, next);
|
||||
}
|
||||
|
||||
GimpGradientSegment *
|
||||
|
|
|
@ -1829,7 +1829,7 @@ gimp_array_new (const guint8 *data,
|
|||
g_return_val_if_fail ((data == NULL && length == 0) ||
|
||||
(data != NULL && length > 0), NULL);
|
||||
|
||||
array = g_new0 (GimpArray, 1);
|
||||
array = g_slice_new0 (GimpArray);
|
||||
|
||||
array->data = static_data ? (guint8 *) data : g_memdup (data, length);
|
||||
array->length = length;
|
||||
|
@ -1855,7 +1855,7 @@ gimp_array_free (GimpArray *array)
|
|||
if (! array->static_data)
|
||||
g_free (array->data);
|
||||
|
||||
g_free (array);
|
||||
g_slice_free (GimpArray, array);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2544,7 +2544,7 @@ gimp_string_array_new (const gchar **data,
|
|||
g_return_val_if_fail ((data == NULL && length == 0) ||
|
||||
(data != NULL && length > 0), NULL);
|
||||
|
||||
array = g_new0 (GimpArray, 1);
|
||||
array = g_slice_new0 (GimpArray);
|
||||
|
||||
if (! static_data)
|
||||
{
|
||||
|
@ -2593,7 +2593,7 @@ gimp_string_array_free (GimpArray *array)
|
|||
g_free (array->data);
|
||||
}
|
||||
|
||||
g_free (array);
|
||||
g_slice_free (GimpArray, array);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -404,7 +404,7 @@ gimp_undo_idle_free (GimpUndoIdle *idle)
|
|||
if (idle->context)
|
||||
g_object_unref (idle->context);
|
||||
|
||||
g_free (idle);
|
||||
g_slice_free (GimpUndoIdle, idle);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -424,7 +424,7 @@ gimp_undo_create_preview (GimpUndo *undo,
|
|||
}
|
||||
else
|
||||
{
|
||||
GimpUndoIdle *idle = g_new0 (GimpUndoIdle, 1);
|
||||
GimpUndoIdle *idle = g_slice_new0 (GimpUndoIdle);
|
||||
|
||||
idle->undo = undo;
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ gimp_plug_in_cleanup_undo_group_start (GimpPlugIn *plug_in,
|
|||
|
||||
if (! cleanup)
|
||||
{
|
||||
cleanup = g_new0 (GimpPlugInCleanupImage, 1);
|
||||
cleanup = g_slice_new0 (GimpPlugInCleanupImage);
|
||||
|
||||
cleanup->image = image;
|
||||
cleanup->undo_group_count = image->group_count;
|
||||
|
@ -100,7 +100,7 @@ gimp_plug_in_cleanup_undo_group_end (GimpPlugIn *plug_in,
|
|||
if (cleanup->undo_group_count == image->group_count - 1)
|
||||
{
|
||||
proc_frame->cleanups = g_list_remove (proc_frame->cleanups, cleanup);
|
||||
g_free (cleanup);
|
||||
g_slice_free (GimpPlugInCleanupImage, cleanup);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -143,7 +143,7 @@ gimp_plug_in_cleanup (GimpPlugIn *plug_in,
|
|||
}
|
||||
}
|
||||
|
||||
g_free (cleanup);
|
||||
g_slice_free (GimpPlugInCleanupImage, cleanup);
|
||||
}
|
||||
|
||||
g_list_free (proc_frame->cleanups);
|
||||
|
|
|
@ -59,7 +59,7 @@ gimp_plug_in_manager_data_free (GimpPlugInManager *manager)
|
|||
|
||||
g_free (data->identifier);
|
||||
g_free (data->data);
|
||||
g_free (data);
|
||||
g_slice_free (GimpPlugInData, data);
|
||||
}
|
||||
|
||||
g_list_free (manager->data_list);
|
||||
|
@ -69,9 +69,9 @@ gimp_plug_in_manager_data_free (GimpPlugInManager *manager)
|
|||
|
||||
void
|
||||
gimp_plug_in_manager_set_data (GimpPlugInManager *manager,
|
||||
const gchar *identifier,
|
||||
gint32 bytes,
|
||||
const guint8 *data)
|
||||
const gchar *identifier,
|
||||
gint32 bytes,
|
||||
const guint8 *data)
|
||||
{
|
||||
GimpPlugInData *plug_in_data;
|
||||
GList *list;
|
||||
|
@ -92,7 +92,7 @@ gimp_plug_in_manager_set_data (GimpPlugInManager *manager,
|
|||
/* If there isn't already data with the specified identifier, create one */
|
||||
if (list == NULL)
|
||||
{
|
||||
plug_in_data = g_new0 (GimpPlugInData, 1);
|
||||
plug_in_data = g_slice_new0 (GimpPlugInData);
|
||||
plug_in_data->identifier = g_strdup (identifier);
|
||||
|
||||
manager->data_list = g_list_prepend (manager->data_list, plug_in_data);
|
||||
|
|
|
@ -54,7 +54,7 @@ gimp_plug_in_manager_help_domain_exit (GimpPlugInManager *manager)
|
|||
g_free (domain->prog_name);
|
||||
g_free (domain->domain_name);
|
||||
g_free (domain->domain_uri);
|
||||
g_free (domain);
|
||||
g_slice_free (GimpPlugInHelpDomain, domain);
|
||||
}
|
||||
|
||||
g_slist_free (manager->help_domains);
|
||||
|
@ -73,7 +73,7 @@ gimp_plug_in_manager_add_help_domain (GimpPlugInManager *manager,
|
|||
g_return_if_fail (prog_name != NULL);
|
||||
g_return_if_fail (domain_name != NULL);
|
||||
|
||||
domain = g_new (GimpPlugInHelpDomain, 1);
|
||||
domain = g_slice_new (GimpPlugInHelpDomain);
|
||||
|
||||
domain->prog_name = g_strdup (prog_name);
|
||||
domain->domain_name = g_strdup (domain_name);
|
||||
|
|
|
@ -59,7 +59,7 @@ gimp_plug_in_manager_locale_domain_exit (GimpPlugInManager *manager)
|
|||
g_free (domain->prog_name);
|
||||
g_free (domain->domain_name);
|
||||
g_free (domain->domain_path);
|
||||
g_free (domain);
|
||||
g_slice_free (GimpPlugInLocaleDomain, domain);
|
||||
}
|
||||
|
||||
g_slist_free (manager->locale_domains);
|
||||
|
@ -78,7 +78,7 @@ gimp_plug_in_manager_add_locale_domain (GimpPlugInManager *manager,
|
|||
g_return_if_fail (prog_name != NULL);
|
||||
g_return_if_fail (domain_name != NULL);
|
||||
|
||||
domain = g_new (GimpPlugInLocaleDomain, 1);
|
||||
domain = g_slice_new (GimpPlugInLocaleDomain);
|
||||
|
||||
domain->prog_name = g_strdup (prog_name);
|
||||
domain->domain_name = g_strdup (domain_name);
|
||||
|
|
|
@ -44,7 +44,7 @@ gimp_plug_in_manager_menu_branch_exit (GimpPlugInManager *manager)
|
|||
g_free (branch->prog_name);
|
||||
g_free (branch->menu_path);
|
||||
g_free (branch->menu_label);
|
||||
g_free (branch);
|
||||
g_slice_free (GimpPlugInMenuBranch, branch);
|
||||
}
|
||||
|
||||
g_slist_free (manager->menu_branches);
|
||||
|
@ -64,7 +64,7 @@ gimp_plug_in_manager_add_menu_branch (GimpPlugInManager *manager,
|
|||
g_return_if_fail (menu_path != NULL);
|
||||
g_return_if_fail (menu_label != NULL);
|
||||
|
||||
branch = g_new (GimpPlugInMenuBranch, 1);
|
||||
branch = g_slice_new (GimpPlugInMenuBranch);
|
||||
|
||||
branch->prog_name = g_strdup (prog_name);
|
||||
branch->menu_path = g_strdup (menu_path);
|
||||
|
|
|
@ -48,7 +48,7 @@ gimp_plug_in_proc_frame_new (GimpContext *context,
|
|||
g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL);
|
||||
g_return_val_if_fail (GIMP_IS_PLUG_IN_PROCEDURE (procedure), NULL);
|
||||
|
||||
proc_frame = g_new0 (GimpPlugInProcFrame, 1);
|
||||
proc_frame = g_slice_new0 (GimpPlugInProcFrame);
|
||||
|
||||
proc_frame->ref_count = 1;
|
||||
|
||||
|
@ -151,7 +151,7 @@ gimp_plug_in_proc_frame_unref (GimpPlugInProcFrame *proc_frame,
|
|||
if (proc_frame->ref_count < 1)
|
||||
{
|
||||
gimp_plug_in_proc_frame_dispose (proc_frame, plug_in);
|
||||
g_free (proc_frame);
|
||||
g_slice_free (GimpPlugInProcFrame, proc_frame);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,8 +35,8 @@ gimp_anchor_get_type (void)
|
|||
|
||||
if (!anchor_type)
|
||||
anchor_type = g_boxed_type_register_static ("GimpAnchor",
|
||||
(GBoxedCopyFunc) gimp_anchor_copy,
|
||||
(GBoxedFreeFunc) gimp_anchor_free);
|
||||
(GBoxedCopyFunc) gimp_anchor_copy,
|
||||
(GBoxedFreeFunc) gimp_anchor_free);
|
||||
|
||||
return anchor_type;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ GimpAnchor *
|
|||
gimp_anchor_new (GimpAnchorType type,
|
||||
const GimpCoords *position)
|
||||
{
|
||||
GimpAnchor *anchor = g_new0 (GimpAnchor, 1);
|
||||
GimpAnchor *anchor = g_slice_new0 (GimpAnchor);
|
||||
|
||||
anchor->type = type;
|
||||
|
||||
|
@ -58,11 +58,21 @@ gimp_anchor_new (GimpAnchorType type,
|
|||
GimpAnchor *
|
||||
gimp_anchor_copy (const GimpAnchor *anchor)
|
||||
{
|
||||
return g_memdup (anchor, sizeof (GimpAnchor));
|
||||
GimpAnchor *new;
|
||||
|
||||
g_return_val_if_fail (anchor != NULL, NULL);
|
||||
|
||||
new = g_slice_new (GimpAnchor);
|
||||
|
||||
*new = *anchor;
|
||||
|
||||
return new;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_anchor_free (GimpAnchor *anchor)
|
||||
{
|
||||
g_free (anchor);
|
||||
g_return_if_fail (anchor != NULL);
|
||||
|
||||
g_slice_free (GimpAnchor, anchor);
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ gimp_session_info_aux_new (const gchar *name,
|
|||
g_return_val_if_fail (name != NULL, NULL);
|
||||
g_return_val_if_fail (value != NULL, NULL);
|
||||
|
||||
aux = g_new0 (GimpSessionInfoAux, 1);
|
||||
aux = g_slice_new0 (GimpSessionInfoAux);
|
||||
|
||||
aux->name = g_strdup (name);
|
||||
aux->value = g_strdup (value);
|
||||
|
@ -157,7 +157,7 @@ gimp_session_info_aux_free (GimpSessionInfoAux *aux)
|
|||
|
||||
g_free (aux->name);
|
||||
g_free (aux->value);
|
||||
g_free (aux);
|
||||
g_slice_free (GimpSessionInfoAux, aux);
|
||||
}
|
||||
|
||||
GList *
|
||||
|
@ -1217,7 +1217,7 @@ session_info_aux_deserialize (GScanner *scanner,
|
|||
|
||||
case G_TOKEN_IDENTIFIER:
|
||||
{
|
||||
aux_info = g_new0 (GimpSessionInfoAux, 1);
|
||||
aux_info = g_slice_new0 (GimpSessionInfoAux);
|
||||
|
||||
aux_info->name = g_strdup (scanner->value.v_identifier);
|
||||
|
||||
|
|
Loading…
Reference in New Issue