[gnome-builder] macros: use static inline for string funcs
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] macros: use static inline for string funcs
- Date: Sun, 3 May 2015 21:27:13 +0000 (UTC)
commit ac2c6f443c5a4500a4baa4b9550a1fa346f1ab31
Author: Christian Hergert <christian hergert me>
Date: Sun May 3 14:27:07 2015 -0700
macros: use static inline for string funcs
This should allow us to use them from various callback APIs like
GHashTable.
libide/ide-macros.h | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/libide/ide-macros.h b/libide/ide-macros.h
index f9c740c..dc746e7 100644
--- a/libide/ide-macros.h
+++ b/libide/ide-macros.h
@@ -37,8 +37,18 @@ G_BEGIN_DECLS
} \
} G_STMT_END
-#define ide_str_empty0(str) (((str) == NULL)||(*(str) == 0))
-#define ide_str_equal0(a,b) (g_strcmp0((a),(b)) == 0)
+static inline gboolean
+ide_str_empty0 (const gchar *str)
+{
+ return (str != NULL) && (str[0] != '\0');
+}
+
+static inline gboolean
+ide_str_equal0 (gconstpointer a,
+ gconstpointer b)
+{
+ return (g_strcmp0 ((const gchar *)a, (const gchar *)b) == 0);
+}
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]