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



commit f1993c5dda4c92f11aa0ade7e95a2d389272ce3f
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 60752d5..0b780bc 100644
--- a/services/lastfm/lastfm.c
+++ b/services/lastfm/lastfm.c
@@ -265,15 +265,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]