Sun, 10 May 2009 22:29:28 +0000
Qulogic pointed out that glib has G_N_ELEMENTS already
| libpurple/internal.h | file | annotate | diff | comparison | revisions | |
| libpurple/protocols/myspace/myspace.c | file | annotate | diff | comparison | revisions |
--- a/libpurple/internal.h Sun May 10 22:24:37 2009 +0000 +++ b/libpurple/internal.h Sun May 10 22:29:28 2009 +0000 @@ -256,10 +256,6 @@ #endif -#ifndef ARRAY_LENGTH -#define ARRAY_LENGTH(arr) (sizeof(arr) / sizeof(*arr)) -#endif - /* Safer ways to work with static buffers. When using non-static * buffers, either use g_strdup_* functions (preferred) or use * g_strlcpy/g_strlcpy directly. */
--- a/libpurple/protocols/myspace/myspace.c Sun May 10 22:24:37 2009 +0000 +++ b/libpurple/protocols/myspace/myspace.c Sun May 10 22:29:28 2009 +0000 @@ -861,10 +861,10 @@ { "FriendRequest", MSIM_INBOX_FRIEND_REQUEST, "http://messaging.myspace.com/index.cfm?fuseaction=mail.friendRequests", NULL }, { "PictureComment", MSIM_INBOX_PICTURE_COMMENT, "http://home.myspace.com/index.cfm?fuseaction=user", NULL } }; - const gchar *froms[ARRAY_LENGTH(message_types) + 1] = { "" }, - *tos[ARRAY_LENGTH(message_types) + 1] = { "" }, - *urls[ARRAY_LENGTH(message_types) + 1] = { "" }, - *subjects[ARRAY_LENGTH(message_types) + 1] = { "" }; + const gchar *froms[G_N_ELEMENTS(message_types) + 1] = { "" }, + *tos[G_N_ELEMENTS(message_types) + 1] = { "" }, + *urls[G_N_ELEMENTS(message_types) + 1] = { "" }, + *subjects[G_N_ELEMENTS(message_types) + 1] = { "" }; g_return_if_fail(reply != NULL); @@ -886,7 +886,7 @@ n = 0; - for (i = 0; i < sizeof(message_types) / sizeof(message_types[0]); ++i) { + for (i = 0; i < G_N_ELEMENTS(message_types); ++i) { const gchar *key; guint bit;