changeset 19254:9245404fe70c

In msim_msg_get(), start at the given node instead of using g_list_first() to back track and find the first node (since GList's are doubly-linked, it can do this). This means that msim_msg_get_*() functions now return values beginning from the MsimMessage * that was passed to the function, instead of at the very beginning, so you can pass an MsimMessage pointer in the middle of an MsimMessage (which is really just a GList) and it will search starting from where you gave it.
author Jeffrey Connelly <jaconnel@calpoly.edu>
date Sun, 19 Aug 2007 23:43:48 +0000
parents b66c5991c011
children 1ea47b06f1a6
files libpurple/protocols/myspace/message.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/myspace/message.c	Sun Aug 19 21:43:12 2007 +0000
+++ b/libpurple/protocols/myspace/message.c	Sun Aug 19 23:43:48 2007 +0000
@@ -1003,21 +1003,21 @@
 static GList *
 msim_msg_get_node(MsimMessage *msg, const gchar *name)
 {
-	GList *i;
+	GList *node;
 
 	if (!name) {
 		return NULL;
 	}
 
 	/* Linear search for the given name. O(n) but n is small. */
-	for (i = g_list_first(msg); i != NULL; i = g_list_next(i)) {
+	for (node = msg; node != NULL; node = g_list_next(node)) {
 		MsimMessageElement *elem;
 
-		elem = i->data;
+		elem = node->data;
 		g_return_val_if_fail(elem != NULL, NULL);
 
 		if (strcmp(elem->name, name) == 0) {
-			return i;
+			return node;
 		}
 	}
 	return NULL;