diff libpurple/protocols/myspace/myspace.c @ 26852:0b97f73fa3d2

correctly NULL terminate all the arrays since that's what gtknotify assumes, also fixed a memory leak in gmail notification
author Ka-Hing Cheung <khc@hxbc.us>
date Sun, 10 May 2009 22:06:08 +0000
parents b87843de7c6a
children ef61a2b746bd
line wrap: on
line diff
--- a/libpurple/protocols/myspace/myspace.c	Fri May 08 03:54:58 2009 +0000
+++ b/libpurple/protocols/myspace/myspace.c	Sun May 10 22:06:08 2009 +0000
@@ -847,8 +847,6 @@
 	MsimMessage *body;
 	guint old_inbox_status;
 	guint i, n;
-	const gchar *froms[5], *tos[5], *urls[5], *subjects[5];
-
 	/* Information for each new inbox message type. */
 	static struct
 	{
@@ -863,16 +861,22 @@
 		{ "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] = { "" };
+
+	g_return_if_fail(reply != NULL);
 
 	/* Can't write _()'d strings in array initializers. Workaround. */
+	/* khc: then use N_() in the array initializer and use _() when they are
+	   used */
 	message_types[0].text = _("New mail messages");
 	message_types[1].text = _("New blog comments");
 	message_types[2].text = _("New profile comments");
 	message_types[3].text = _("New friend requests!");
 	message_types[4].text = _("New picture comments");
 
-	g_return_if_fail(reply != NULL);
-
 	body = msim_msg_get_dictionary(reply, "body");
 
 	if (body == NULL)