Commit ee25bfc8 authored by Jehan's avatar Jehan

libgimpbase: add gimp_pixpipe_params_free().

And use it where appropriate. A public API asking you to know the
internals of your code is a bad idea.
parent b585201e
...@@ -43,7 +43,6 @@ gimp_brush_pipe_load (GimpContext *context, ...@@ -43,7 +43,6 @@ gimp_brush_pipe_load (GimpContext *context,
GError **error) GError **error)
{ {
GimpBrushPipe *pipe = NULL; GimpBrushPipe *pipe = NULL;
GimpPixPipeParams params;
gint i; gint i;
gint num_of_brushes = 0; gint num_of_brushes = 0;
gint totalcells; gint totalcells;
...@@ -125,6 +124,8 @@ gimp_brush_pipe_load (GimpContext *context, ...@@ -125,6 +124,8 @@ gimp_brush_pipe_load (GimpContext *context,
if (*paramstring) if (*paramstring)
{ {
GimpPixPipeParams params;
gimp_pixpipe_params_init (&params); gimp_pixpipe_params_init (&params);
gimp_pixpipe_params_parse (paramstring, &params); gimp_pixpipe_params_parse (paramstring, &params);
...@@ -132,10 +133,7 @@ gimp_brush_pipe_load (GimpContext *context, ...@@ -132,10 +133,7 @@ gimp_brush_pipe_load (GimpContext *context,
pipe->rank = g_new0 (gint, pipe->dimension); pipe->rank = g_new0 (gint, pipe->dimension);
pipe->select = g_new0 (PipeSelectModes, pipe->dimension); pipe->select = g_new0 (PipeSelectModes, pipe->dimension);
pipe->index = g_new0 (gint, pipe->dimension); pipe->index = g_new0 (gint, pipe->dimension);
/* placement is not used at all ?? */ /* placement is not used at all ?? */
if (params.free_placement_string)
g_free (params.placement);
for (i = 0; i < pipe->dimension; i++) for (i = 0; i < pipe->dimension; i++)
{ {
...@@ -156,9 +154,10 @@ gimp_brush_pipe_load (GimpContext *context, ...@@ -156,9 +154,10 @@ gimp_brush_pipe_load (GimpContext *context,
pipe->select[i] = PIPE_SELECT_TILT_Y; pipe->select[i] = PIPE_SELECT_TILT_Y;
else else
pipe->select[i] = PIPE_SELECT_CONSTANT; pipe->select[i] = PIPE_SELECT_CONSTANT;
g_free (params.selection[i]);
pipe->index[i] = 0; pipe->index[i] = 0;
} }
gimp_pixpipe_params_free (&params);
} }
else else
{ {
......
...@@ -190,3 +190,15 @@ gimp_pixpipe_params_build (GimpPixPipeParams *params) ...@@ -190,3 +190,15 @@ gimp_pixpipe_params_build (GimpPixPipeParams *params)
return g_string_free (str, FALSE); return g_string_free (str, FALSE);
} }
void
gimp_pixpipe_params_free (GimpPixPipeParams *params)
{
gint i;
for (i = 0; i < GIMP_PIXPIPE_MAXDIM; i++)
g_free (params->selection[i]);
if (params->free_placement_string)
g_free (params->placement);
}
...@@ -67,6 +67,8 @@ void gimp_pixpipe_params_parse (const gchar *parameters, ...@@ -67,6 +67,8 @@ void gimp_pixpipe_params_parse (const gchar *parameters,
/* Build a string representation of GimpPixPipeParams */ /* Build a string representation of GimpPixPipeParams */
gchar * gimp_pixpipe_params_build (GimpPixPipeParams *params) G_GNUC_MALLOC; gchar * gimp_pixpipe_params_build (GimpPixPipeParams *params) G_GNUC_MALLOC;
/* Free the internal values. It does not free the struct itsef. */
void gimp_pixpipe_params_free (GimpPixPipeParams *params);
G_END_DECLS G_END_DECLS
......
...@@ -424,6 +424,8 @@ run (const gchar *name, ...@@ -424,6 +424,8 @@ run (const gchar *name,
} }
} }
gimp_pixpipe_params_free (&gihparams);
if (export == GIMP_EXPORT_EXPORT) if (export == GIMP_EXPORT_EXPORT)
gimp_image_delete (image_ID); gimp_image_delete (image_ID);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment