[gimp] libgimpbase: always allocate GimpPixPipeParams.placement, add docs



commit f28ec4bf867b4ae14c98ef653c0fe36e6e3ab86e
Author: Michael Natterer <mitch gimp org>
Date:   Wed Jul 24 02:09:49 2019 +0200

    libgimpbase: always allocate GimpPixPipeParams.placement, add docs

 libgimpbase/gimpparasiteio.c | 12 ++++++------
 libgimpbase/gimpparasiteio.h | 17 +++++++++++++++++
 2 files changed, 23 insertions(+), 6 deletions(-)
---
diff --git a/libgimpbase/gimpparasiteio.c b/libgimpbase/gimpparasiteio.c
index d55d1a21a5..727048a535 100644
--- a/libgimpbase/gimpparasiteio.c
+++ b/libgimpbase/gimpparasiteio.c
@@ -61,10 +61,11 @@ gimp_pixpipe_params_init (GimpPixPipeParams *params)
   params->dim        = 1;
   params->cols       = 1;
   params->rows       = 1;
-  params->placement  = "constant";
-  params->free_placement_string = FALSE;
+  params->placement  = g_strdup ("constant");
+
   for (i = 0; i < GIMP_PIXPIPE_MAXDIM; i++)
     params->selection[i] = g_strdup ("random");
+
   params->rank[0] = 1;
   for (i = 1; i < GIMP_PIXPIPE_MAXDIM; i++)
     params->rank[i] = 0;
@@ -133,8 +134,8 @@ gimp_pixpipe_params_parse (const gchar       *string,
         {
           if (r)
             {
+              g_free (params->placement);
               params->placement = g_strdup (r + 1);
-              params->free_placement_string = TRUE;
             }
         }
       else if (strncmp (p, "rank", strlen ("rank")) == 0 && r)
@@ -196,9 +197,8 @@ gimp_pixpipe_params_free (GimpPixPipeParams *params)
 {
   gint i;
 
+  g_free (params->placement);
+
   for (i = 0; i < GIMP_PIXPIPE_MAXDIM; i++)
     g_free (params->selection[i]);
-
-  if (params->free_placement_string)
-    g_free (params->placement);
 }
diff --git a/libgimpbase/gimpparasiteio.h b/libgimpbase/gimpparasiteio.h
index c8dabc7b30..9024b4813b 100644
--- a/libgimpbase/gimpparasiteio.h
+++ b/libgimpbase/gimpparasiteio.h
@@ -40,6 +40,23 @@ G_BEGIN_DECLS
 
 typedef struct _GimpPixPipeParams GimpPixPipeParams;
 
+/**
+ * GimpPixPipeParams:
+ * @step:                  Step
+ * @ncells:                Number of cells
+ * @dim:                   Dimension
+ * @cols:                  Columns
+ * @rows:                  Rows
+ * @cellwidth:             Cell width
+ * @cellheight:            Cell height
+ * @placement:             Placement
+ * @free_placement_string: Unused, ignore
+ * @rank:                  Rank
+ * @selection:             Selection
+ * @free_selection_string: Unused, ignore
+ *
+ * PLease somebody help documenting this.
+ **/
 struct _GimpPixPipeParams
 {
   gint      step;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]