[gimp] Don't try to make quarks from NULL strings



commit 962bf514c8d5ab0295a2b1df84bc8bc42ef7141f
Author: Michael Natterer <mitch gimp org>
Date:   Tue Oct 27 19:44:05 2009 +0100

    Don't try to make quarks from NULL strings
    
    Because that warns badly. The functionality is unchanged though
    because the code does properly check for 0 quarks. Also moved some
    variables to local scopes.

 app/core/gimptagcache.c |   27 ++++++++++++++++++---------
 1 files changed, 18 insertions(+), 9 deletions(-)
---
diff --git a/app/core/gimptagcache.c b/app/core/gimptagcache.c
index a691ba2..c5501ce 100644
--- a/app/core/gimptagcache.c
+++ b/app/core/gimptagcache.c
@@ -235,17 +235,22 @@ gimp_tag_cache_add_object (GimpTagCache *cache,
 {
   gchar  *identifier;
   GQuark  identifier_quark = 0;
-  gchar  *checksum_string;
-  GQuark  checksum_quark;
-  GList  *list;
-  gint    i;
 
   identifier = gimp_tagged_get_identifier (tagged);
-  identifier_quark = g_quark_try_string (identifier);
-  g_free (identifier);
+
+  if (identifier)
+    {
+      identifier_quark = g_quark_try_string (identifier);
+      g_free (identifier);
+    }
 
   if (! gimp_tagged_get_tags (tagged))
     {
+      gchar  *checksum;
+      GQuark  checksum_quark = 0;
+      GList  *list;
+      gint    i;
+
       if (identifier_quark)
         {
           for (i = 0; i < cache->priv->records->len; i++)
@@ -266,9 +271,13 @@ gimp_tag_cache_add_object (GimpTagCache *cache,
             }
         }
 
-      checksum_string = gimp_tagged_get_checksum (tagged);
-      checksum_quark = g_quark_try_string (checksum_string);
-      g_free (checksum_string);
+      checksum = gimp_tagged_get_checksum (tagged);
+
+      if (checksum)
+        {
+          checksum_quark = g_quark_try_string (checksum);
+          g_free (checksum);
+        }
 
       if (checksum_quark)
         {



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