[Xfce4-commits] <exo:master> Add exo_str_is_empty() macro.
Nick Schermer
nick at xfce.org
Wed Aug 19 18:16:01 CEST 2009
Updating branch refs/heads/master
to ed360b61b22334a58e3d9e8acfd0ace2b2001dcf (commit)
from 10d04c4d5bbd1a6a62a5aea2745e3f13dab00400 (commit)
commit ed360b61b22334a58e3d9e8acfd0ace2b2001dcf
Author: Nick Schermer <nick at xfce.org>
Date: Wed Aug 19 16:55:11 2009 +0200
Add exo_str_is_empty() macro.
Add a helper macro check check if a string is NULL
or starts with a nul-terminated character.
docs/reference/exo-sections.txt | 1 +
docs/reference/tmpl/exo-string.sgml | 11 +++++++++++
exo/exo-string.h | 2 ++
3 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/docs/reference/exo-sections.txt b/docs/reference/exo-sections.txt
index 47cd6e2..4624b34 100644
--- a/docs/reference/exo-sections.txt
+++ b/docs/reference/exo-sections.txt
@@ -450,6 +450,7 @@ exo_mount_point_list_configured
<TITLE>String Utility Functions</TITLE>
exo_str_elide_underscores
exo_str_is_equal
+exo_str_is_empty
exo_str_replace
exo_strdup_strftime
exo_strndupv
diff --git a/docs/reference/tmpl/exo-string.sgml b/docs/reference/tmpl/exo-string.sgml
index b8ed5f0..fbeb114 100644
--- a/docs/reference/tmpl/exo-string.sgml
+++ b/docs/reference/tmpl/exo-string.sgml
@@ -36,6 +36,17 @@ Stable
@Returns:
+
+<!-- ##### MACRO exo_str_is_empty ##### -->
+<para>
+ Macro to check if a string is %NULL or empty. You should prefer
+ this function over strlen (str) == 0.
+</para>
+
+ at string: a string
+ at Returns: %TRUE if @str is %NULL or "".
+
+
<!-- ##### FUNCTION exo_str_replace ##### -->
<para>
diff --git a/exo/exo-string.h b/exo/exo-string.h
index 1ac075a..1a9390e 100644
--- a/exo/exo-string.h
+++ b/exo/exo-string.h
@@ -48,6 +48,8 @@ gchar **exo_strndupv (gchar **strv,
#define I_(string) (g_intern_static_string ((string)))
+#define exo_str_is_empty(string) ((string) == NULL || *(string) == '\0')
+
G_END_DECLS
#endif /* !__EXO_STRING_H__ */
More information about the Xfce4-commits
mailing list