gegl r1865 - in trunk: . gegl gegl/buffer gegl/graph



Author: neo
Date: Fri Jan 18 17:23:21 2008
New Revision: 1865
URL: http://svn.gnome.org/viewvc/gegl?rev=1865&view=rev

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

	* gegl/buffer/gegl-buffer-load.c
	* gegl/buffer/gegl-buffer-save.c
	* gegl/buffer/gegl-handler-cache.c
	* gegl/buffer/gegl-tile-disk.c
	* gegl/buffer/gegl-tile-mem.c
	* gegl/graph/gegl-node-context.c
	* gegl/gegl-instrument.c: use GSlice in some more places.


Modified:
   trunk/ChangeLog
   trunk/gegl/buffer/gegl-buffer-load.c
   trunk/gegl/buffer/gegl-buffer-save.c
   trunk/gegl/buffer/gegl-handler-cache.c
   trunk/gegl/buffer/gegl-tile-disk.c
   trunk/gegl/buffer/gegl-tile-mem.c
   trunk/gegl/gegl-instrument.c
   trunk/gegl/graph/gegl-node-context.c

Modified: trunk/gegl/buffer/gegl-buffer-load.c
==============================================================================
--- trunk/gegl/buffer/gegl-buffer-load.c	(original)
+++ trunk/gegl/buffer/gegl-buffer-load.c	Fri Jan 18 17:23:21 2008
@@ -79,14 +79,14 @@
       g_list_free (info->tiles);
       info->tiles = NULL;
     }
-  g_free (info);
+  g_slice_free (LoadInfo, info);
 }
 
 void
 gegl_buffer_load (GeglBuffer  *buffer,
                   const gchar *path)
 {
-  LoadInfo *info = g_malloc0 (sizeof (LoadInfo));
+  LoadInfo *info = g_slice_new0 (LoadInfo);
 
   if (sizeof (GeglBufferFileHeader) != 256)
     {
@@ -173,4 +173,3 @@
 
   load_info_destroy (info);
 }
-

Modified: trunk/gegl/buffer/gegl-buffer-save.c
==============================================================================
--- trunk/gegl/buffer/gegl-buffer-save.c	(original)
+++ trunk/gegl/buffer/gegl-buffer-save.c	Fri Jan 18 17:23:21 2008
@@ -101,7 +101,7 @@
       g_list_free (info->tiles);
       info->tiles = NULL;
     }
-  g_free (info);
+  g_slice_free (SaveInfo, info);
 }
 
 
@@ -150,7 +150,7 @@
                   const gchar         *path,
                   const GeglRectangle *roi)
 {
-  SaveInfo *info = g_malloc0 (sizeof (SaveInfo));
+  SaveInfo *info = g_slice_new0 (SaveInfo);
 
   if (sizeof (GeglBufferFileHeader) != 256)
     {

Modified: trunk/gegl/buffer/gegl-handler-cache.c
==============================================================================
--- trunk/gegl/buffer/gegl-handler-cache.c	(original)
+++ trunk/gegl/buffer/gegl-handler-cache.c	Fri Jan 18 17:23:21 2008
@@ -90,7 +90,7 @@
       CacheItem *item = list->data;
       g_object_unref (item->tile);
       cache->list = g_slist_remove (cache->list, item);
-      g_free (item);
+      g_slice_free (CacheItem, item);
     }
 
   G_OBJECT_CLASS (gegl_handler_cache_parent_class)->dispose (object);
@@ -390,7 +390,7 @@
 
       g_object_unref (tile);
       cache->list = g_slist_remove (cache->list, last_writable);
-      g_free (last_writable);
+      g_slice_free (CacheItem, last_writable);
       return TRUE;
     }
   return FALSE;
@@ -404,7 +404,6 @@
                          gint z)
 {
   CacheItem *item = NULL;
-
   GeglTile  *tile = NULL;
 
   if (cache->size > 0)
@@ -447,7 +446,7 @@
           gegl_tile_void (tile);
           g_object_unref (tile);
           cache->list = g_slist_remove (cache->list, item);
-          g_free (item);
+          g_slice_free (CacheItem, item);
         }
       else
         {
@@ -464,7 +463,7 @@
                            gint           z)
 {
   guint      count;
-  CacheItem *item = g_malloc (sizeof (CacheItem));
+  CacheItem *item = g_slice_new (CacheItem);
 
   g_object_ref (G_OBJECT (tile));
   item->tile = tile;

Modified: trunk/gegl/buffer/gegl-tile-disk.c
==============================================================================
--- trunk/gegl/buffer/gegl-tile-disk.c	(original)
+++ trunk/gegl/buffer/gegl-tile-disk.c	Fri Jan 18 17:23:21 2008
@@ -54,9 +54,10 @@
 static void dbg_alloc (int size);
 static void dbg_dealloc (int size);
 
-/* These entries are kept in RAM for now, they should be written as an index to the
- * swap file, at a position specified by a header block, making the header grow up
- * to a multiple of the size used in this swap file is probably a good idea
+/* These entries are kept in RAM for now, they should be written as an
+ * index to the swap file, at a position specified by a header block,
+ * making the header grow up to a multiple of the size used in this
+ * swap file is probably a good idea
  *
  * Serializing the bablformat is probably also a good idea.
  */
@@ -145,7 +146,7 @@
 static inline DiskEntry *
 disk_entry_new (GeglTileDisk *disk)
 {
-  DiskEntry *self = g_malloc (sizeof (DiskEntry));
+  DiskEntry *self = g_slice_new (DiskEntry);
 
   if (disk->free_list)
     {
@@ -175,7 +176,7 @@
   g_hash_table_remove (disk->entries, entry);
 
   dbg_dealloc (GEGL_TILE_BACKEND (disk)->tile_size);
-  g_free (entry);
+  g_slice_free (DiskEntry, entry);
 }
 
 
@@ -379,8 +380,7 @@
   switch (property_id)
     {
       case PROP_PATH:
-        if (self->path)
-          g_value_set_string (value, self->path);
+        g_value_set_string (value, self->path);
         break;
 
       default:

Modified: trunk/gegl/buffer/gegl-tile-mem.c
==============================================================================
--- trunk/gegl/buffer/gegl-tile-mem.c	(original)
+++ trunk/gegl/buffer/gegl-tile-mem.c	Fri Jan 18 17:23:21 2008
@@ -73,7 +73,7 @@
 static inline MemEntry *
 mem_entry_new (GeglTileMem *mem)
 {
-  MemEntry *self = g_malloc (sizeof (MemEntry));
+  MemEntry *self = g_slice_new (MemEntry);
 
   self->offset = g_malloc (GEGL_TILE_BACKEND (mem)->tile_size);
   dbg_alloc (GEGL_TILE_BACKEND (mem)->tile_size);
@@ -88,7 +88,7 @@
   g_hash_table_remove (mem->entries, entry);
 
   dbg_dealloc (GEGL_TILE_BACKEND (mem)->tile_size);
-  g_free (entry);
+  g_slice_free (MemEntry, entry);
 }
 
 

Modified: trunk/gegl/gegl-instrument.c
==============================================================================
--- trunk/gegl/gegl-instrument.c	(original)
+++ trunk/gegl/gegl-instrument.c	Fri Jan 18 17:23:21 2008
@@ -105,7 +105,7 @@
 
   if (root == NULL)
     {
-      root       = g_malloc0 (sizeof (Timing));
+      root       = g_slice_new0 (Timing);
       root->name = g_strdup (parent_name);
     }
   parent = timing_find (root, parent_name);
@@ -118,7 +118,7 @@
   iter = timing_find (parent, name);
   if (!iter)
     {
-      iter             = g_malloc0 (sizeof (Timing));
+      iter             = g_slice_new0 (Timing);
       iter->name       = g_strdup (name);
       iter->parent     = parent;
       iter->next       = parent->children;

Modified: trunk/gegl/graph/gegl-node-context.c
==============================================================================
--- trunk/gegl/graph/gegl-node-context.c	(original)
+++ trunk/gegl/graph/gegl-node-context.c	Fri Jan 18 17:23:21 2008
@@ -153,7 +153,7 @@
 static Property *property_new (GeglNode    *node,
                                const gchar *property_name)
 {
-  Property *property = g_malloc0 (sizeof (Property));
+  Property *property = g_slice_new0 (Property);
 
   property->name = g_strdup (property_name);
   return property;
@@ -161,10 +161,9 @@
 
 static void property_destroy (Property *property)
 {
-  if (property->name)
-    g_free (property->name);
+  g_free (property->name);
   g_value_unset (&property->value); /* does an unref */
-  g_free (property);
+  g_slice_free (Property, property);
 }
 
 static gint



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