[libsocialweb] Don't use G_N_ELEMENTS on non-local arrays (BMC#17863)



commit 56dde1f6e567f0506ff24b031205920e5bb75d16
Author: Alban Crequy <alban crequy collabora co uk>
Date:   Tue May 24 09:44:30 2011 +0100

    Don't use G_N_ELEMENTS on non-local arrays (BMC#17863)

 services/flickr/flickr.c   |    7 ++++---
 services/lastfm/lastfm.c   |    6 +++---
 services/twitter/twitter.c |    7 ++++---
 3 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/services/flickr/flickr.c b/services/flickr/flickr.c
index b1d57f0..b4e5cc0 100644
--- a/services/flickr/flickr.c
+++ b/services/flickr/flickr.c
@@ -326,9 +326,10 @@ initable_iface_init (gpointer g_iface,
 const static gchar *valid_queries[] = { "feed",
                                         "own",
                                         "friends-only",
-                                        "x-flickr-search" };
+                                        "x-flickr-search",
+                                        NULL };
 
-static const gchar *valid_contact_queries[] = { "people" };
+static const gchar *valid_contact_queries[] = { "people", NULL };
 
 
 static gboolean
@@ -336,7 +337,7 @@ _check_query_validity (const gchar *query, const gchar *list[])
 {
   gint i = 0;
 
-  for (i = 0; i < G_N_ELEMENTS (list); i++)
+  for (i = 0 ; list[i] != NULL ; i++)
   {
     if (g_str_equal (query, list[i]))
       return TRUE;
diff --git a/services/lastfm/lastfm.c b/services/lastfm/lastfm.c
index 0bf4a06..4547568 100644
--- a/services/lastfm/lastfm.c
+++ b/services/lastfm/lastfm.c
@@ -460,15 +460,15 @@ lastfm_iface_init (gpointer g_iface,
 
 /* Query interface */
 
-static const gchar *valid_queries[] = { "feed" };
-static const gchar *valid_contact_queries[] = { "people" };
+static const gchar *valid_queries[] = { "feed", NULL };
+static const gchar *valid_contact_queries[] = { "people", NULL };
 
 static gboolean
 _check_query_validity (const gchar *query, const gchar *list[])
 {
   gint i = 0;
 
-  for (i = 0; i < G_N_ELEMENTS(list); i++)
+  for (i = 0 ; list[i] != NULL ; i++)
   {
     if (g_str_equal (query, list[i]))
       return TRUE;
diff --git a/services/twitter/twitter.c b/services/twitter/twitter.c
index efb06df..55aa849 100644
--- a/services/twitter/twitter.c
+++ b/services/twitter/twitter.c
@@ -546,16 +546,17 @@ static const gchar *valid_queries[] = { "feed",
                                         "friends-only",
                                         "x-twitter-mentions",
                                         "x-twitter-stream",
-                                        "x-twitter-trending-topics"};
+                                        "x-twitter-trending-topics",
+                                        NULL };
 
-static const gchar *valid_contact_queries[] = { "people" };
+static const gchar *valid_contact_queries[] = { "people", NULL };
 
 static gboolean
 _check_query_validity (const gchar *query, const gchar *list[])
 {
   gint i = 0;
 
-  for (i = 0; i < G_N_ELEMENTS(list); i++)
+  for (i = 0 ; list[i] != NULL ; i++)
   {
     if (g_str_equal (query, list[i]))
       return TRUE;



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