[Telepathy-commits] [telepathy-glib/master] tp_strv_contains: accept strv=NULL, treating it as the empty list

Will Thompson will.thompson at collabora.co.uk
Tue Sep 9 03:28:52 PDT 2008


---
 telepathy-glib/util.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/telepathy-glib/util.c b/telepathy-glib/util.c
index 05b22cf..307db35 100644
--- a/telepathy-glib/util.c
+++ b/telepathy-glib/util.c
@@ -301,7 +301,8 @@ tp_escape_as_identifier (const gchar *name)
 
 /**
  * tp_strv_contains:
- * @strv: a NULL-terminated array of strings
+ * @strv: a NULL-terminated array of strings, or %NULL (which is treated as an
+ *        empty strv)
  * @str: a non-NULL string
  *
  * <!-- -->
@@ -314,7 +315,9 @@ tp_strv_contains (const gchar * const *strv,
                   const gchar *str)
 {
   g_return_val_if_fail (str != NULL, FALSE);
-  g_return_val_if_fail (strv != NULL, FALSE);
+
+  if (strv == NULL)
+    return FALSE;
 
   while (*strv != NULL)
     {
-- 
1.5.6.3



More information about the Telepathy-commits mailing list