gegl r1927 - in trunk: . gegl/graph



Author: neo
Date: Mon Jan 28 16:20:40 2008
New Revision: 1927
URL: http://svn.gnome.org/viewvc/gegl?rev=1927&view=rev

Log:
2008-01-28  Sven Neumann  <sven gimp org>

	* gegl/graph/gegl-visitor.c: allocate GeglVisitInfo using GSlice.


Modified:
   trunk/ChangeLog
   trunk/gegl/graph/gegl-visitor.c

Modified: trunk/gegl/graph/gegl-visitor.c
==============================================================================
--- trunk/gegl/graph/gegl-visitor.c	(original)
+++ trunk/gegl/graph/gegl-visitor.c	Mon Jan 28 16:20:40 2008
@@ -53,7 +53,7 @@
                                                 GeglVisitable    *visitable);
 static void           init_bfs_traversal       (GeglVisitor      *self,
                                                 GeglVisitable    *visitable);
-static void           visit_info_value_destroy (gpointer          data);
+static void           visit_info_destroy       (GeglVisitInfo    *visit_info);
 static void           insert                   (GeglVisitor      *self,
                                                 GeglVisitable    *visitable);
 static GeglVisitInfo* lookup                   (GeglVisitor      *self,
@@ -158,9 +158,9 @@
 gegl_visitor_init (GeglVisitor *self)
 {
   self->visits_list = NULL;
-  self->hash        = g_hash_table_new_full (g_direct_hash, g_direct_equal,
-                                             NULL,
-                                             visit_info_value_destroy);
+  self->hash = g_hash_table_new_full (g_direct_hash, g_direct_equal,
+                                      NULL,
+                                      (GDestroyNotify) visit_info_destroy);
 }
 
 static void
@@ -185,21 +185,13 @@
 insert (GeglVisitor   *self,
         GeglVisitable *visitable)
 {
-  GeglVisitInfo *visit_info = lookup (self, visitable);
-
-  if (!visit_info)
+  if (lookup (self, visitable))
     {
-      visit_info = g_new0 (GeglVisitInfo, 1);
-
-      visit_info->visited      = FALSE;
-      visit_info->discovered   = FALSE;
-      visit_info->shared_count = 0;
-
-      g_hash_table_insert (self->hash, visitable, visit_info);
+      g_warning ("visitable already in visitor's hash table");
     }
   else
     {
-      g_warning ("visitable already in visitor's hash table");
+      g_hash_table_insert (self->hash, visitable, g_slice_new0 (GeglVisitInfo));
     }
 }
 
@@ -289,11 +281,9 @@
 }
 
 static void
-visit_info_value_destroy (gpointer data)
+visit_info_destroy (GeglVisitInfo *visit_info)
 {
-  GeglVisitInfo *visit_info = data;
-
-  g_free (visit_info);
+  g_slice_free (GeglVisitInfo, visit_info);
 }
 
 /**



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