/dev/tomkiewicz/new-smileys: 87c51487e197: Fix g_slist_remove_li...

Tomasz Wasilczyk twasilczyk at pidgin.im
Fri Apr 4 17:19:53 EDT 2014


Changeset: 87c51487e197896af920e7a923c63fcb46546061
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2014-04-04 23:19 +0200
Branch:	 default
URL: https://hg.pidgin.im/dev/tomkiewicz/new-smileys/rev/87c51487e197

Description:

Fix g_slist_remove_link misuse, remove debug printfs

diffstat:

 libpurple/protocols/bonjour/mdns_avahi.c |   2 +-
 libpurple/protocols/gg/roster.c          |   2 +-
 libpurple/protocols/irc/irc.c            |   2 +-
 libpurple/protocols/jabber/message.c     |  13 +++----------
 libpurple/smiley-list.c                  |   7 +++----
 5 files changed, 9 insertions(+), 17 deletions(-)

diffs (109 lines):

diff --git a/libpurple/protocols/bonjour/mdns_avahi.c b/libpurple/protocols/bonjour/mdns_avahi.c
--- a/libpurple/protocols/bonjour/mdns_avahi.c
+++ b/libpurple/protocols/bonjour/mdns_avahi.c
@@ -136,7 +136,7 @@ static void
 				res = g_slist_find_custom(b_impl->resolvers, r, _find_resolver_data_by_resolver);
 				if (res != NULL) {
 					rd = res->data;
-					b_impl->resolvers = g_slist_remove_link(b_impl->resolvers, res);
+					b_impl->resolvers = g_slist_delete_link(b_impl->resolvers, res);
 
 					/* We've already freed the resolver */
 					rd->resolver = NULL;
diff --git a/libpurple/protocols/gg/roster.c b/libpurple/protocols/gg/roster.c
--- a/libpurple/protocols/gg/roster.c
+++ b/libpurple/protocols/gg/roster.c
@@ -927,7 +927,7 @@ static gboolean ggp_roster_send_update_g
 		while (group_buddies) {
 			ggp_roster_set_synchronized(gc, group_buddies->data,
 				FALSE);
-			group_buddies = g_list_remove_link(group_buddies,
+			group_buddies = g_list_delete_link(group_buddies,
 				group_buddies);
 		}
 		return TRUE;
diff --git a/libpurple/protocols/irc/irc.c b/libpurple/protocols/irc/irc.c
--- a/libpurple/protocols/irc/irc.c
+++ b/libpurple/protocols/irc/irc.c
@@ -225,7 +225,7 @@ void irc_buddy_query(struct irc_conn *ir
 			break;
 		g_string_append_printf(string, "%s ", ib->name);
 		ib->new_online_status = FALSE;
-		irc->buddies_outstanding = g_list_remove_link(irc->buddies_outstanding, lp);
+		irc->buddies_outstanding = g_list_delete_link(irc->buddies_outstanding, lp);
 	}
 
 	if (string->len) {
diff --git a/libpurple/protocols/jabber/message.c b/libpurple/protocols/jabber/message.c
--- a/libpurple/protocols/jabber/message.c
+++ b/libpurple/protocols/jabber/message.c
@@ -938,16 +938,12 @@ jabber_message_smileyfy_xhtml(JabberMess
 
 	conv = purple_conversations_find_with_account(jm->to, account);
 
-	if (!jabber_conv_support_custom_smileys(jm->js, conv, jm->to)) {
-		purple_debug_fatal("tomo", "custom smileys not supported");
+	if (!jabber_conv_support_custom_smileys(jm->js, conv, jm->to))
 		return NULL;
-	}
 
 	found_smileys = purple_smiley_find(purple_smiley_custom_get_list(), xhtml);
-	if (!found_smileys) {
-		purple_debug_fatal("tomo", "no smileys found");
+	if (!found_smileys)
 		return NULL;
-	}
 
 	for (it = found_smileys; it; it = it_next) {
 		PurpleSmiley *smiley = it->data;
@@ -982,10 +978,8 @@ jabber_message_smileyfy_xhtml(JabberMess
 			PURPLE_MESSAGE_ERROR, time(NULL));
 	}
 
-	if (!found_smileys) {
-		purple_debug_fatal("tomo", "no valid smileys found");
+	if (!found_smileys)
 		return NULL;
-	}
 
 	for (it = found_smileys; it; it = g_list_next(it)) {
 		PurpleSmiley *smiley = it->data;
@@ -1019,7 +1013,6 @@ jabber_message_smileyfy_xhtml(JabberMess
 
 	g_list_free(found_smileys);
 
-	purple_debug_fatal("tomo", "replaced some smileys");
 	return smileyfied_xhtml;
 }
 
diff --git a/libpurple/smiley-list.c b/libpurple/smiley-list.c
--- a/libpurple/smiley-list.c
+++ b/libpurple/smiley-list.c
@@ -72,7 +72,7 @@ static void
 }
 
 static void
-_list_remove_link2(GList **head_p, GList **tail_p, GList *link)
+_list_delete_link2(GList **head_p, GList **tail_p, GList *link)
 {
 	GList *head = *head_p;
 	GList *tail = *tail_p;
@@ -82,8 +82,7 @@ static void
 
 	if (link == tail)
 		*tail_p = tail->prev;
-	/* TODO: shouldn't it be _delete_link? */
-	*head_p = g_list_remove_link(head, link);
+	*head_p = g_list_delete_link(head, link);
 }
 
 /*******************************************************************************
@@ -198,7 +197,7 @@ purple_smiley_list_remove(PurpleSmileyLi
 	purple_trie_remove(priv->trie, shortcut);
 	g_free(shortcut_escaped);
 
-	_list_remove_link2(&priv->smileys, &priv->smileys_end, list_elem);
+	_list_delete_link2(&priv->smileys, &priv->smileys_end, list_elem);
 
 	/* re-add entry to path_map if smiley was not unique */
 	for (it = priv->smileys; it && path; it = g_list_next(it)) {



More information about the Commits mailing list