[gnome-builder] libide/core: remove unnecessary strcmp



commit b373cefb0e5b6f4f0cfe6a531c7652c2022d525d
Author: Christian Hergert <chergert redhat com>
Date:   Fri Aug 12 21:52:59 2022 -0700

    libide/core: remove unnecessary strcmp
    
    We would always have to free one side, so just drop the strcmp altogether.

 src/libide/core/ide-macros.h | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
---
diff --git a/src/libide/core/ide-macros.h b/src/libide/core/ide-macros.h
index d319ec80f..cbbf621bb 100644
--- a/src/libide/core/ide-macros.h
+++ b/src/libide/core/ide-macros.h
@@ -107,14 +107,10 @@ static inline void
 ide_take_string (char **ptr,
                  char  *str)
 {
-  if (*ptr == str || g_strcmp0 (*ptr, str) == 0)
-    {
-      g_free (str);
-      return;
-    }
-
-  g_clear_pointer (ptr, g_free);
-  *ptr = g_steal_pointer (&str);
+  if (*ptr == NULL && str == NULL)
+    return;
+  g_free (*ptr);
+  *ptr = str;
 }
 
 static inline void


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