gimp r26668 - in trunk: . plug-ins/file-ico



Author: neo
Date: Wed Aug 20 06:24:45 2008
New Revision: 26668
URL: http://svn.gnome.org/viewvc/gimp?rev=26668&view=rev

Log:
2008-08-20  Sven Neumann  <sven gimp org>

	* plug-ins/file-ico/ico-save.c: create GHashTable with destroy
	notifiers.



Modified:
   trunk/ChangeLog
   trunk/plug-ins/file-ico/ico-save.c

Modified: trunk/plug-ins/file-ico/ico-save.c
==============================================================================
--- trunk/plug-ins/file-ico/ico-save.c	(original)
+++ trunk/plug-ins/file-ico/ico-save.c	Wed Aug 20 06:24:45 2008
@@ -378,9 +378,11 @@
                                  gint           num_colors)
 {
   GHashTable *hash;
-  gint i;
+  gint        i;
 
-  hash = g_hash_table_new (g_int_hash, g_int_equal);
+  hash = g_hash_table_new_full (g_int_hash, g_int_equal,
+                                (GDestroyNotify) g_free,
+                                (GDestroyNotify) g_free);
 
   for (i = 0; i < num_colors; i++)
     {
@@ -400,20 +402,6 @@
   return hash;
 }
 
-
-static void
-ico_free_hash_item (gpointer data1,
-                    gpointer data2,
-                    gpointer data3)
-{
-  g_free (data1);
-  g_free (data2);
-
-  /* Shut up warnings: */
-  data3 = NULL;
-}
-
-
 static gint
 ico_get_palette_index (GHashTable *hash,
                        gint        red,
@@ -809,7 +797,7 @@
                              &palette, &buffer);
   buffer32 = (guint32 *) buffer;
 
-  /* Set up colormap and andmap when necessary: */
+  /* Set up colormap and and_map when necessary: */
   if (header.bpp <= 8)
     {
       /* Create a colormap */
@@ -953,10 +941,7 @@
      and_len, xor_len));
 
   if (color_to_slot)
-    {
-      g_hash_table_foreach (color_to_slot, ico_free_hash_item, NULL);
-      g_hash_table_destroy (color_to_slot);
-    }
+    g_hash_table_destroy (color_to_slot);
 
   g_free (palette);
   g_free (buffer);



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