changeset 14348:80b05108652c

[gaim-migrate @ 17050] Use GSList in a few places instead of GList, and use g_list_prepend and then g_list_reverse in a few places instead of g_list_append committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 26 Aug 2006 19:12:05 +0000
parents a8140cbe08ce
children 2816a4a0fcc2
files libgaim/protocols/oscar/family_chat.c libgaim/protocols/oscar/family_oservice.c libgaim/protocols/oscar/flap_connection.c libgaim/protocols/oscar/oscar.c libgaim/protocols/oscar/oscar.h libgaim/protocols/oscar/oscar_data.c libgaim/protocols/oscar/peer.c
diffstat 7 files changed, 71 insertions(+), 65 deletions(-) [+]
line wrap: on
line diff
--- a/libgaim/protocols/oscar/family_chat.c	Sat Aug 26 17:28:30 2006 +0000
+++ b/libgaim/protocols/oscar/family_chat.c	Sat Aug 26 19:12:05 2006 +0000
@@ -67,7 +67,7 @@
 FlapConnection *
 aim_chat_getconn(OscarData *od, const char *name)
 {
-	GList *cur;
+	GSList *cur;
 
 	for (cur = od->oscar_connections; cur; cur = cur->next)
 	{
--- a/libgaim/protocols/oscar/family_oservice.c	Sat Aug 26 17:28:30 2006 +0000
+++ b/libgaim/protocols/oscar/family_oservice.c	Sat Aug 26 19:12:05 2006 +0000
@@ -33,7 +33,7 @@
 {
 	FlapFrame *frame;
 	aim_snacid_t snacid;
-	GList *cur;
+	GSList *cur;
 
 	frame = flap_frame_new(od, 0x02, 1152);
 
@@ -82,7 +82,7 @@
 	while (byte_stream_empty(bs))
 	{
 		group = byte_stream_get16(bs);
-		conn->groups = g_list_prepend(conn->groups, GUINT_TO_POINTER(group));
+		conn->groups = g_slist_prepend(conn->groups, GUINT_TO_POINTER(group));
 	}
 
 	/*
@@ -500,7 +500,7 @@
 {
 	FlapFrame *frame;
 	aim_snacid_t snacid;
-	GList *cur;
+	GSList *cur;
 
 	frame = flap_frame_new(od, 0x02, 1024);
 
@@ -742,7 +742,7 @@
 {
 	FlapFrame *frame;
 	aim_snacid_t snacid;
-	GList *cur;
+	GSList *cur;
 
 	frame = flap_frame_new(od, 0x02, 1152);
 
--- a/libgaim/protocols/oscar/flap_connection.c	Sat Aug 26 17:28:30 2006 +0000
+++ b/libgaim/protocols/oscar/flap_connection.c	Sat Aug 26 19:12:05 2006 +0000
@@ -124,7 +124,7 @@
 	conn->subtype = -1;
 	conn->type = type;
 
-	od->oscar_connections = g_list_prepend(od->oscar_connections, conn);
+	od->oscar_connections = g_slist_prepend(od->oscar_connections, conn);
 
 	return conn;
 }
@@ -220,10 +220,10 @@
 	if (conn->type == SNAC_FAMILY_CHAT)
 		flap_connection_destroy_chat(od, conn);
 
-	g_list_free(conn->groups);
+	g_slist_free(conn->groups);
 	flap_connection_destroy_rates(conn->rates);
 
-	od->oscar_connections = g_list_remove(od->oscar_connections, conn);
+	od->oscar_connections = g_slist_remove(od->oscar_connections, conn);
 
 	account = gaim_connection_get_account(od->gc);
 
@@ -351,12 +351,12 @@
 FlapConnection *
 flap_connection_findbygroup(OscarData *od, guint16 group)
 {
-	GList *cur;
+	GSList *cur;
 
 	for (cur = od->oscar_connections; cur != NULL; cur = cur->next)
 	{
 		FlapConnection *conn;
-		GList *l;
+		GSList *l;
 
 		conn = cur->data;
 
@@ -385,7 +385,7 @@
 FlapConnection *
 flap_connection_getbytype(OscarData *od, int type)
 {
-	GList *cur;
+	GSList *cur;
 
 	for (cur = od->oscar_connections; cur != NULL; cur = cur->next)
 	{
@@ -401,7 +401,7 @@
 FlapConnection *
 flap_connection_getbytype_all(OscarData *od, int type)
 {
-	GList *cur;
+	GSList *cur;
 
 	for (cur = od->oscar_connections; cur; cur = cur->next)
 	{
--- a/libgaim/protocols/oscar/oscar.c	Sat Aug 26 17:28:30 2006 +0000
+++ b/libgaim/protocols/oscar/oscar.c	Sat Aug 26 19:12:05 2006 +0000
@@ -972,7 +972,7 @@
 	}
 	else if (conn->type == SNAC_FAMILY_CHAT)
 	{
-		od->oscar_chats = g_slist_append(od->oscar_chats, conn->new_conn_data);
+		od->oscar_chats = g_slist_prepend(od->oscar_chats, conn->new_conn_data);
 		conn->new_conn_data = NULL;
 	}
 }
@@ -5174,7 +5174,7 @@
 		gaim_debug_info("oscar", "chatnav does not exist, opening chatnav\n");
 		cr->exchange = atoi(exchange);
 		cr->name = g_strdup(name);
-		od->create_rooms = g_slist_append(od->create_rooms, cr);
+		od->create_rooms = g_slist_prepend(od->create_rooms, cr);
 		aim_reqservice(od, SNAC_FAMILY_CHATNAV);
 	}
 }
@@ -5600,24 +5600,24 @@
 										   NULL, TRUE, TRUE, FALSE,
 										   "message", _("Message"),
 										   gaim_value_new(GAIM_TYPE_STRING), NULL);
-	status_types = g_list_append(status_types, type);
+	status_types = g_list_prepend(status_types, type);
 
 	type = gaim_status_type_new_full(GAIM_STATUS_AVAILABLE,
 									 OSCAR_STATUS_ID_FREE4CHAT,
 									 _("Free For Chat"), TRUE, is_icq, FALSE);
-	status_types = g_list_append(status_types, type);
+	status_types = g_list_prepend(status_types, type);
 
 	type = gaim_status_type_new_with_attrs(GAIM_STATUS_AWAY,
 										   OSCAR_STATUS_ID_AWAY,
 										   NULL, TRUE, TRUE, FALSE,
 										   "message", _("Message"),
 										   gaim_value_new(GAIM_TYPE_STRING), NULL);
-	status_types = g_list_append(status_types, type);
+	status_types = g_list_prepend(status_types, type);
 
 	type = gaim_status_type_new_full(GAIM_STATUS_INVISIBLE,
 									 OSCAR_STATUS_ID_INVISIBLE,
 									 NULL, TRUE, TRUE, FALSE);
-	status_types = g_list_append(status_types, type);
+	status_types = g_list_prepend(status_types, type);
 
 	/* ICQ-specific status types */
 	type = gaim_status_type_new_with_attrs(GAIM_STATUS_UNAVAILABLE,
@@ -5625,26 +5625,28 @@
 				_("Occupied"), TRUE, is_icq, FALSE,
 				"message", _("Message"),
 				gaim_value_new(GAIM_TYPE_STRING), NULL);
-	status_types = g_list_append(status_types, type);
+	status_types = g_list_prepend(status_types, type);
 
 	type = gaim_status_type_new_with_attrs(GAIM_STATUS_EXTENDED_AWAY,
 				OSCAR_STATUS_ID_DND,
 				_("Do Not Disturb"), TRUE, is_icq, FALSE,
 				"message", _("Message"),
 				gaim_value_new(GAIM_TYPE_STRING), NULL);
-	status_types = g_list_append(status_types, type);
+	status_types = g_list_prepend(status_types, type);
 
 	type = gaim_status_type_new_with_attrs(GAIM_STATUS_EXTENDED_AWAY,
 				OSCAR_STATUS_ID_NA,
 				_("Not Available"), TRUE, is_icq, FALSE,
 				"message", _("Message"),
 				gaim_value_new(GAIM_TYPE_STRING), NULL);
-	status_types = g_list_append(status_types, type);
+	status_types = g_list_prepend(status_types, type);
 
 	type = gaim_status_type_new_full(GAIM_STATUS_OFFLINE,
 									 OSCAR_STATUS_ID_OFFLINE,
 									 NULL, TRUE, TRUE, FALSE);
-	status_types = g_list_append(status_types, type);
+	status_types = g_list_prepend(status_types, type);
+
+	status_types = g_list_reverse(status_types);
 
 	return status_types;
 }
@@ -5779,27 +5781,27 @@
 
 	GaimConnection *gc;
 	OscarData *od;
-	GList *m;
+	GList *menu;
 	GaimMenuAction *act;
 	aim_userinfo_t *userinfo;
 
 	gc = gaim_account_get_connection(buddy->account);
 	od = gc->proto_data;
 	userinfo = aim_locate_finduserinfo(od, buddy->name);
-	m = NULL;
+	menu = NULL;
 
 	if (od->icq && aim_sn_is_icq(gaim_buddy_get_name(buddy)))
 	{
 		act = gaim_menu_action_new(_("Get AIM Info"),
 								   GAIM_CALLBACK(oscar_get_aim_info_cb),
 								   NULL, NULL);
-		m = g_list_append(m, act);
+		menu = g_list_prepend(menu, act);
 	}
 
 	act = gaim_menu_action_new(_("Edit Buddy Comment"),
 	                           GAIM_CALLBACK(oscar_buddycb_edit_comment),
 	                           NULL, NULL);
-	m = g_list_append(m, act);
+	menu = g_list_prepend(menu, act);
 
 #if 0
 	if (od->icq)
@@ -5807,7 +5809,7 @@
 		act = gaim_menu_action_new(_("Get Status Msg"),
 		                           GAIM_CALLBACK(oscar_get_icqstatusmsg),
 		                           NULL, NULL);
-		m = g_list_append(m, act);
+		menu = g_list_prepend(menu, act);
 	}
 #endif
 
@@ -5820,7 +5822,7 @@
 			act = gaim_menu_action_new(_("Direct IM"),
 			                           GAIM_CALLBACK(oscar_ask_directim),
 			                           NULL, NULL);
-			m = g_list_append(m, act);
+			menu = g_list_prepend(menu, act);
 		}
 #if 0
 		/* TODO: This menu item should be added by the core */
@@ -5828,7 +5830,7 @@
 			act = gaim_menu_action_new(_("Get File"),
 			                           GAIM_CALLBACK(oscar_ask_getfile),
 			                           NULL, NULL);
-			m = g_list_append(m, act);
+			menu = g_list_prepend(menu, act);
 		}
 #endif
 	}
@@ -5842,11 +5844,13 @@
 			act = gaim_menu_action_new(_("Re-request Authorization"),
 			                           GAIM_CALLBACK(gaim_auth_sendrequest_menu),
 			                           NULL, NULL);
-			m = g_list_append(m, act);
+			menu = g_list_prepend(menu, act);
 		}
 	}
 
-	return m;
+	menu = g_list_reverse(menu);
+
+	return menu;
 }
 
 
@@ -6213,83 +6217,85 @@
 {
 	GaimConnection *gc = (GaimConnection *) context;
 	OscarData *od = gc->proto_data;
-	GList *m = NULL;
+	GList *menu = NULL;
 	GaimPluginAction *act;
 
 	act = gaim_plugin_action_new(_("Set User Info..."),
 			oscar_show_set_info);
-	m = g_list_append(m, act);
+	menu = g_list_prepend(menu, act);
 
 	if (od->icq)
 	{
 		act = gaim_plugin_action_new(_("Set User Info (URL)..."),
 				oscar_show_set_info_icqurl);
-		m = g_list_append(m, act);
+		menu = g_list_prepend(menu, act);
 	}
 
 	act = gaim_plugin_action_new(_("Change Password..."),
 			oscar_change_pass);
-	m = g_list_append(m, act);
+	menu = g_list_prepend(menu, act);
 
 	if (od->authinfo->chpassurl != NULL)
 	{
 		act = gaim_plugin_action_new(_("Change Password (URL)"),
 				oscar_show_chpassurl);
-		m = g_list_append(m, act);
+		menu = g_list_prepend(menu, act);
 
 		act = gaim_plugin_action_new(_("Configure IM Forwarding (URL)"),
 				oscar_show_imforwardingurl);
-		m = g_list_append(m, act);
-	}
-
-	m = g_list_append(m, NULL);
+		menu = g_list_prepend(menu, act);
+	}
+
+	menu = g_list_prepend(menu, NULL);
 
 	if (od->icq)
 	{
 		/* ICQ actions */
 		act = gaim_plugin_action_new(_("Set Privacy Options..."),
 				oscar_show_icq_privacy_opts);
-		m = g_list_append(m, act);
+		menu = g_list_prepend(menu, act);
 	}
 	else
 	{
 		/* AIM actions */
 		act = gaim_plugin_action_new(_("Format Screen Name..."),
 				oscar_show_format_screenname);
-		m = g_list_append(m, act);
+		menu = g_list_prepend(menu, act);
 
 		act = gaim_plugin_action_new(_("Confirm Account"),
 				oscar_confirm_account);
-		m = g_list_append(m, act);
+		menu = g_list_prepend(menu, act);
 
 		act = gaim_plugin_action_new(_("Display Currently Registered E-Mail Address"),
 				oscar_show_email);
-		m = g_list_append(m, act);
+		menu = g_list_prepend(menu, act);
 
 		act = gaim_plugin_action_new(_("Change Currently Registered E-Mail Address..."),
 				oscar_show_change_email);
-		m = g_list_append(m, act);
-	}
-
-	m = g_list_append(m, NULL);
+		menu = g_list_prepend(menu, act);
+	}
+
+	menu = g_list_prepend(menu, NULL);
 
 	act = gaim_plugin_action_new(_("Show Buddies Awaiting Authorization"),
 			oscar_show_awaitingauth);
-	m = g_list_append(m, act);
-
-	m = g_list_append(m, NULL);
+	menu = g_list_prepend(menu, act);
+
+	menu = g_list_prepend(menu, NULL);
 
 	act = gaim_plugin_action_new(_("Search for Buddy by E-Mail Address..."),
 			oscar_show_find_email);
-	m = g_list_append(m, act);
+	menu = g_list_prepend(menu, act);
 
 #if 0
 	act = gaim_plugin_action_new(_("Search for Buddy by Information"),
 			show_find_info);
-	m = g_list_append(m, act);
+	menu = g_list_prepend(menu, act);
 #endif
 
-	return m;
+	menu = g_list_reverse(menu);
+
+	return menu;
 }
 
 static void oscar_change_passwd(GaimConnection *gc, const char *old, const char *new)
--- a/libgaim/protocols/oscar/oscar.h	Sat Aug 26 17:28:30 2006 +0000
+++ b/libgaim/protocols/oscar/oscar.h	Sat Aug 26 19:12:05 2006 +0000
@@ -383,7 +383,7 @@
 	guint16 subtype;
 	flap_seqnum_t seqnum;
 	guint32 status;
-	GList *groups;
+	GSList *groups;
 	struct rateclass *rates;
 
 	void *internal; /* internal conn-specific libfaim data */
@@ -492,13 +492,13 @@
 	} ssi;
 
 	/* TODO: Implement this as a HashTable for HUGE speed improvement! */
-	GList *handlerlist;
+	GSList *handlerlist;
 
 	/** A linked list containing FlapConnections. */
-	GList *oscar_connections;
+	GSList *oscar_connections;
 
 	/** A linked list containing PeerConnections. */
-	GList *peer_connections;
+	GSList *peer_connections;
 };
 
 /* Valid for calling aim_icq_setstatus() and for aim_userinfo_t->icqinfo.status */
--- a/libgaim/protocols/oscar/oscar_data.c	Sat Aug 26 17:28:30 2006 +0000
+++ b/libgaim/protocols/oscar/oscar_data.c	Sat Aug 26 19:12:05 2006 +0000
@@ -139,7 +139,7 @@
 	snac_handler->flags = flags;
 	snac_handler->handler = newhandler;
 
-	od->handlerlist = g_list_prepend(od->handlerlist, snac_handler);
+	od->handlerlist = g_slist_prepend(od->handlerlist, snac_handler);
 
 	return 0;
 }
@@ -152,7 +152,7 @@
 	while (od->handlerlist != NULL)
 	{
 		snac_handler = od->handlerlist->data;
-		od->handlerlist = g_list_remove(od->handlerlist, snac_handler);
+		od->handlerlist = g_slist_remove(od->handlerlist, snac_handler);
 		g_free(snac_handler);
 	}
 	od->handlerlist = NULL;
@@ -161,7 +161,7 @@
 aim_rxcallback_t
 aim_callhandler(OscarData *od, guint16 family, guint16 type)
 {
-	GList *cur;
+	GSList *cur;
 	SnacHandler *snac_handler;
 
 	for (cur = od->handlerlist; cur != NULL; cur = cur->next)
--- a/libgaim/protocols/oscar/peer.c	Sat Aug 26 17:28:30 2006 +0000
+++ b/libgaim/protocols/oscar/peer.c	Sat Aug 26 19:12:05 2006 +0000
@@ -71,7 +71,7 @@
 PeerConnection *
 peer_connection_find_by_type(OscarData *od, const char *sn, OscarCapability type)
 {
-	GList *cur;
+	GSList *cur;
 	PeerConnection *conn;
 
 	for (cur = od->peer_connections; cur != NULL; cur = cur->next)
@@ -90,7 +90,7 @@
 PeerConnection *
 peer_connection_find_by_cookie(OscarData *od, const char *sn, const guchar *cookie)
 {
-	GList *cur;
+	GSList *cur;
 	PeerConnection *conn;
 
 	for (cur = od->peer_connections; cur != NULL; cur = cur->next)
@@ -126,7 +126,7 @@
 	else if (type == OSCAR_CAPABILITY_SENDFILE)
 		memcpy(conn->magic, "OFT2", 4);
 
-	od->peer_connections = g_list_prepend(od->peer_connections, conn);
+	od->peer_connections = g_slist_prepend(od->peer_connections, conn);
 
 	return conn;
 }
@@ -224,7 +224,7 @@
 	g_free(conn->verifiedip);
 	gaim_circ_buffer_destroy(conn->buffer_outgoing);
 
-	conn->od->peer_connections = g_list_remove(conn->od->peer_connections, conn);
+	conn->od->peer_connections = g_slist_remove(conn->od->peer_connections, conn);
 
 	g_free(conn);