[gegl/wip/pippin/pipeline: 84/95] gegl-buffer-iterator2: consolidate allocation into one



commit 7410eab718bfc75959102aa6588dc8c388af9c93
Author: Øyvind Kolås <pippin gimp org>
Date:   Wed Jul 25 14:36:34 2018 +0200

    gegl-buffer-iterator2: consolidate allocation into one

 gegl/buffer/gegl-buffer-iterator2.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer-iterator2.c b/gegl/buffer/gegl-buffer-iterator2.c
index 331f1c07c..27aee57b6 100644
--- a/gegl/buffer/gegl-buffer-iterator2.c
+++ b/gegl/buffer/gegl-buffer-iterator2.c
@@ -87,9 +87,12 @@ static inline GeglBufferIterator2 *
 _gegl_buffer_iterator2_empty_new (gint max_slots)
 {
   GeglBufferIterator2 *iter = g_malloc0 (sizeof (GeglBufferIterator2) +
+                                         max_slots * sizeof (GeglBufferIterator2Item) +
+                                         sizeof (GeglBufferIterator2Priv) +
+                                         max_slots * sizeof (SubIterState));
+  iter->priv      = (void*)(((char*)iter) + sizeof (GeglBufferIterator2) +
                                          max_slots * sizeof (GeglBufferIterator2Item));
-  iter->priv      = g_malloc0 (sizeof (GeglBufferIterator2Priv) +
-                               max_slots * sizeof (SubIterState));
+
   iter->priv->max_slots = max_slots;
 
   iter->priv->num_buffers = 0;
@@ -589,7 +592,6 @@ _gegl_buffer_iterator2_stop (GeglBufferIterator2 *iter)
         }
     }
 
-  g_free (iter->priv);
   g_free (iter);
 }
 


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