summaryrefslogtreecommitdiff
path: root/telepathy-glib/util.h
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2010-04-01 14:13:16 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2010-04-01 14:13:16 +0100
commita042c778d08a84c794c7d38c29e5f7919a1bad80 (patch)
treefcb43051a94fc7a4089916794e2e60b9153bfed9 /telepathy-glib/util.h
parent82558e9415b197586a99e689673934214f2780df (diff)
downloadtelepathy-glib-a042c778d08a84c794c7d38c29e5f7919a1bad80.tar.gz
util: add tp_str_empty()
By popular demand, since everyone who uses telepathy-glib seems to invent their own FOO_STR_EMPTY macro :-) It's a #define wrapper around an inline function, in order to provide type-safety and only evaluate its argument once (which occasionally matters).
Diffstat (limited to 'telepathy-glib/util.h')
-rw-r--r--telepathy-glib/util.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/telepathy-glib/util.h b/telepathy-glib/util.h
index 1b23e53fd..3bdc3d496 100644
--- a/telepathy-glib/util.h
+++ b/telepathy-glib/util.h
@@ -65,6 +65,14 @@ GValue *tp_g_value_slice_dup (const GValue *value) G_GNUC_WARN_UNUSED_RESULT;
void tp_g_hash_table_update (GHashTable *target, GHashTable *source,
GBoxedCopyFunc key_dup, GBoxedCopyFunc value_dup);
+#define tp_str_empty(s) (tp_str_empty_inline (s))
+
+static inline gboolean
+tp_str_empty_inline (const gchar *s)
+{
+ return (s == NULL || s[0] == '\0');
+}
+
gboolean tp_strdiff (const gchar *left, const gchar *right);
gpointer tp_mixin_offset_cast (gpointer instance, guint offset);