[gimp/soc-2010-cage] app: use g_strcmp0() where strings can be NULL instead of checking manually



commit 5a802b18eea2cdfb9ab2317121a605acdf5189f7
Author: Michael Natterer <mitch gimp org>
Date:   Sun Jun 6 19:15:49 2010 +0200

    app: use g_strcmp0() where strings can be NULL instead of checking manually

 app/actions/documents-commands.c |    2 +-
 app/core/gimpobject.c            |    6 ++----
 app/core/gimppdbprogress.c       |    3 +--
 app/core/gimptagcache.c          |    2 +-
 4 files changed, 5 insertions(+), 8 deletions(-)
---
diff --git a/app/actions/documents-commands.c b/app/actions/documents-commands.c
index d16473f..ecf110b 100644
--- a/app/actions/documents-commands.c
+++ b/app/actions/documents-commands.c
@@ -354,7 +354,7 @@ documents_raise_display (GimpDisplay  *display,
 {
   const gchar *uri = gimp_object_get_name (gimp_display_get_image (display));
 
-  if (uri && ! strcmp (closure->name, uri))
+  if (! g_strcmp0 (closure->name, uri))
     {
       closure->found = TRUE;
       gimp_display_shell_present (gimp_display_get_shell (display));
diff --git a/app/core/gimpobject.c b/app/core/gimpobject.c
index bd41cad..15ab2a9 100644
--- a/app/core/gimpobject.c
+++ b/app/core/gimpobject.c
@@ -205,8 +205,7 @@ gimp_object_set_name (GimpObject  *object,
 {
   g_return_if_fail (GIMP_IS_OBJECT (object));
 
-  if ((!object->p->name && !name) ||
-      (object->p->name && name && !strcmp (object->p->name, name)))
+  if (! g_strcmp0 (object->p->name, name))
     return;
 
   gimp_object_name_free (object);
@@ -233,8 +232,7 @@ gimp_object_set_name_safe (GimpObject  *object,
 {
   g_return_if_fail (GIMP_IS_OBJECT (object));
 
-  if ((!object->p->name && !name) ||
-      (object->p->name && name && !strcmp (object->p->name, name)))
+  if (! g_strcmp0 (object->p->name, name))
     return;
 
   gimp_object_name_free (object);
diff --git a/app/core/gimppdbprogress.c b/app/core/gimppdbprogress.c
index 54949dc..0e4c89a 100644
--- a/app/core/gimppdbprogress.c
+++ b/app/core/gimppdbprogress.c
@@ -419,8 +419,7 @@ gimp_pdb_progress_get_by_callback (GimpPdbProgressClass *klass,
     {
       GimpPdbProgress *progress = list->data;
 
-      if (progress->callback_name &&
-          strcmp (callback_name, progress->callback_name) == 0)
+      if (! g_strcmp0 (callback_name, progress->callback_name))
         return progress;
     }
 
diff --git a/app/core/gimptagcache.c b/app/core/gimptagcache.c
index 057c64a..9434006 100644
--- a/app/core/gimptagcache.c
+++ b/app/core/gimptagcache.c
@@ -566,7 +566,7 @@ gimp_tag_cache_load_text (GMarkupParseContext  *context,
 
   current_element = g_markup_parse_context_get_element (context);
 
-  if (current_element && strcmp (current_element, "tag") == 0)
+  if (g_strcmp0 (current_element, "tag") == 0)
     {
       if (text_len >= sizeof (buffer))
         {



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