pidgin: 5a72a1d4: Fix some "Dead nested assignment"s and t...

qulogic at pidgin.im qulogic at pidgin.im
Sat Aug 14 02:25:48 EDT 2010


----------------------------------------------------------------------
Revision: 5a72a1d42505dcd3a2a005e6424f96bf87dea5ec
Parent:   31251ef18953a338888e0e80b1492a59cd564154
Author:   qulogic at pidgin.im
Date:     08/14/10 01:17:38
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/5a72a1d42505dcd3a2a005e6424f96bf87dea5ec

Changelog: 

Fix some "Dead nested assignment"s and then kill off some useless
variables related to them.

Changes against parent 31251ef18953a338888e0e80b1492a59cd564154

  patched  finch/libgnt/gntentry.c
  patched  finch/libgnt/gnttextview.c
  patched  libpurple/log.c
  patched  libpurple/plugins/tcl/tcl_cmd.c
  patched  libpurple/plugins/tcl/tcl_signals.c
  patched  libpurple/protocols/bonjour/jabber.c
  patched  libpurple/protocols/bonjour/mdns_avahi.c
  patched  libpurple/protocols/jabber/bosh.c
  patched  libpurple/protocols/jabber/disco.c
  patched  libpurple/protocols/jabber/message.c
  patched  libpurple/protocols/jabber/si.c
  patched  libpurple/protocols/qq/qq.c
  patched  libpurple/protocols/qq/qq_trans.c
  patched  libpurple/protocols/yahoo/libymsg.c
  patched  libpurple/protocols/yahoo/yahoochat.c
  patched  libpurple/proxy.c
  patched  pidgin/gtkblist.c
  patched  pidgin/gtkutils.c
  patched  pidgin/plugins/xmppconsole.c

-------------- next part --------------
============================================================
--- libpurple/proxy.c	daf96c2871ea2f5450a5ddec2432b2685415779d
+++ libpurple/proxy.c	1197144134979db3dab0964a4cff13f144650141
@@ -1023,7 +1023,7 @@ http_canread(gpointer data, gint source,
 
 				g_free(response);
 
-			} else if((header = g_strrstr((const char *)connect_data->read_buffer, "Proxy-Authenticate: Basic"))) {
+			} else if (g_strrstr((const char *)connect_data->read_buffer, "Proxy-Authenticate: Basic") != NULL) {
 				gchar *t1, *t2;
 				const char *username, *password;
 
============================================================
--- libpurple/protocols/yahoo/libymsg.c	a8de912ac1d3e210a98b1c3cc89d94eaced6b6b8
+++ libpurple/protocols/yahoo/libymsg.c	7391ab5db5a30f95558539984f67c460a94d25d2
@@ -502,8 +502,6 @@ static void yahoo_process_list_15(Purple
 	char *temp = NULL;
 	YahooFriend *f = NULL; /* It's your friends. They're going to want you to share your StarBursts. */
 	                       /* But what if you had no friends? */
-	PurpleBuddy *b;
-	PurpleGroup *g;
 	YahooFederation fed = YAHOO_FEDERATION_NONE;
 	int stealth = 0;
 
@@ -549,7 +547,9 @@ static void yahoo_process_list_15(Purple
 				if (yd->current_list15_grp) {
 					/* This buddy is in a group */
 					f = yahoo_friend_find_or_new(gc, norm_bud);
-					if (!(b = purple_find_buddy(account, norm_bud))) {
+					if (!purple_find_buddy(account, norm_bud)) {
+						PurpleBuddy *b;
+						PurpleGroup *g;
 						if (!(g = purple_find_group(yd->current_list15_grp))) {
 							g = purple_group_new(yd->current_list15_grp);
 							purple_blist_add_group(g, NULL);
@@ -636,8 +636,6 @@ static void yahoo_process_list(PurpleCon
 	GSList *l = pkt->hash;
 	gboolean export = FALSE;
 	gboolean got_serv_list = FALSE;
-	PurpleBuddy *b;
-	PurpleGroup *g;
 	YahooFriend *f = NULL;
 	PurpleAccount *account = purple_connection_get_account(gc);
 	YahooData *yd = gc->proto_data;
@@ -705,7 +703,9 @@ static void yahoo_process_list(PurpleCon
 				norm_bud = g_strdup(purple_normalize(account, *bud));
 				f = yahoo_friend_find_or_new(gc, norm_bud);
 
-				if (!(b = purple_find_buddy(account, norm_bud))) {
+				if (!purple_find_buddy(account, norm_bud)) {
+					PurpleBuddy *b;
+					PurpleGroup *g;
 					if (!(g = purple_find_group(grp))) {
 						g = purple_group_new(grp);
 						purple_blist_add_group(g, NULL);
@@ -3806,13 +3806,12 @@ const char *yahoo_list_emblem(PurpleBudd
 {
 	PurpleAccount *account;
 	PurpleConnection *gc;
-	YahooData *yd;
 	YahooFriend *f;
 	PurplePresence *presence;
 
 	if (!b || !(account = purple_buddy_get_account(b)) ||
 			!(gc = purple_account_get_connection(account)) ||
-			!(yd = gc->proto_data))
+			!gc->proto_data)
 		return NULL;
 
 	f = yahoo_friend_find(gc, purple_buddy_get_name(b));
============================================================
--- libpurple/log.c	6eb41ef373632163452c5ce4ccee063891e0f560
+++ libpurple/log.c	d44c76dbd3a39f8d4b783ef535eb06c60f0368de
@@ -1681,7 +1681,6 @@ static GList *old_logger_list(PurpleLogT
 	struct tm tm;
 	char month[4];
 	struct old_logger_data *data = NULL;
-	char *newlog;
 	int logfound = 0;
 	int lastoff = 0;
 	int newlen;
@@ -1783,7 +1782,7 @@ static GList *old_logger_list(PurpleLogT
 	}
 
 	while (fgets(buf, BUF_LONG, file)) {
-		if ((newlog = strstr(buf, "---- New C"))) {
+		if (strstr(buf, "---- New C") != NULL) {
 			int length;
 			int offset;
 			char convostart[32];
============================================================
--- pidgin/gtkutils.c	b6dcc467269dfd69571545b6c2e9ae87cc134608
+++ pidgin/gtkutils.c	19ce43c5c5b0ef1c8973242de0259f1f1c4f381b
@@ -1036,7 +1036,7 @@ pidgin_parse_x_im_contact(const char *ms
 	char *username = NULL;
 	char *alias    = NULL;
 	char *str;
-	char *c, *s;
+	char *s;
 	gboolean valid;
 
 	g_return_val_if_fail(msg          != NULL, FALSE);
@@ -1078,7 +1078,7 @@ pidgin_parse_x_im_contact(const char *ms
 		if (*s == '\r') *s++ = '\0';
 		if (*s == '\n') *s++ = '\0';
 
-		if ((c = strchr(key, ':')) != NULL)
+		if (strchr(key, ':') != NULL)
 		{
 			if (!g_ascii_strcasecmp(key, "X-IM-Username:"))
 				username = g_strdup(value);
============================================================
--- pidgin/gtkblist.c	869e7e1d564efe6738fa3d61f4cf4e8026ffa6a6
+++ pidgin/gtkblist.c	0a64110bb315821dec175defc0f634fc93f4c615
@@ -3168,7 +3168,6 @@ pidgin_blist_create_tooltip_for_node(Gtk
 	} else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) {
 		PurpleBlistNode *child;
 		PurpleBuddy *b = purple_contact_get_priority_buddy((PurpleContact *)node);
-		width = height = 0;
 
 		for(child = node->child; child; child = child->next)
 		{
============================================================
--- libpurple/plugins/tcl/tcl_signals.c	51bf25251be26b57609deec47562eff384c96dca
+++ libpurple/plugins/tcl/tcl_signals.c	063914419b890e12b2f7d9fbcba7c1c01c87e55a
@@ -160,7 +160,7 @@ static void *tcl_signal_callback(va_list
 {
 	GString *name, *val;
 	PurpleBlistNode *node;
-	int error, i;
+	int i;
 	void *retval = NULL;
 	Tcl_Obj *cmd, *arg, *result;
 	void **vals; /* Used for inout parameters */
@@ -335,7 +335,7 @@ static void *tcl_signal_callback(va_list
 	}
 
 	/* Call the friggin' procedure already */
-	if ((error = Tcl_EvalObjEx(handler->interp, cmd, TCL_EVAL_GLOBAL)) != TCL_OK) {
+	if (Tcl_EvalObjEx(handler->interp, cmd, TCL_EVAL_GLOBAL) != TCL_OK) {
 		purple_debug(PURPLE_DEBUG_ERROR, "tcl", "error evaluating callback: %s\n",
 			   Tcl_GetString(Tcl_GetObjResult(handler->interp)));
 	} else {
@@ -345,7 +345,7 @@ static void *tcl_signal_callback(va_list
 			if (purple_value_get_type(handler->returntype) == PURPLE_TYPE_STRING) {
 				retval = (void *)g_strdup(Tcl_GetString(result));
 			} else {
-				if ((error = Tcl_GetIntFromObj(handler->interp, result, (int *)&retval)) != TCL_OK) {
+				if (Tcl_GetIntFromObj(handler->interp, result, (int *)&retval) != TCL_OK) {
 					purple_debug(PURPLE_DEBUG_ERROR, "tcl", "Error retrieving procedure result: %s\n",
 						   Tcl_GetString(Tcl_GetObjResult(handler->interp)));
 					retval = NULL;
============================================================
--- libpurple/protocols/yahoo/yahoochat.c	de23d08d079948d87ca3dae3b248b80016fdfec6
+++ libpurple/protocols/yahoo/yahoochat.c	bf69f24ffbd9b7ebc9fb9ac1a58af72fa237ac49
@@ -121,7 +121,6 @@ void yahoo_process_conference_invite(Pur
 	char *msg = NULL;
 	GString *members = NULL;
 	GHashTable *components;
-	PurpleConversation *c = NULL;
 
 	if ( (pkt->status == 2) || (pkt->status == 11) )
 		return; /* Status is 11 when we are being notified about invitation being sent to someone else */
@@ -133,7 +132,7 @@ void yahoo_process_conference_invite(Pur
 		if (pair->key == 57)
 		{
 			room = yahoo_string_decode(gc, pair->value, FALSE);
-			if((c = yahoo_find_conference(gc, room)))
+			if (yahoo_find_conference(gc, room) != NULL)
 			{
 				/* Looks like we got invited to an already open conference. */
 				/* Laters: Should we accept this conference rather than ignoring the invitation ? */
@@ -880,7 +879,6 @@ static void yahoo_chat_leave(PurpleConne
 {
 	YahooData *yd = gc->proto_data;
 	struct yahoo_packet *pkt;
-	PurpleConversation *c;
 
 	char *eroom;
 	gboolean utf8 = 1;
@@ -905,7 +903,7 @@ static void yahoo_chat_leave(PurpleConne
 		yd->chat_name = NULL;
 	}
 
-	if ((c = purple_find_chat(gc, YAHOO_CHAT_ID)))
+	if (purple_find_chat(gc, YAHOO_CHAT_ID) != NULL)
 		serv_got_chat_left(gc, YAHOO_CHAT_ID);
 
 	if (!logout)
============================================================
--- libpurple/protocols/jabber/message.c	413753d807ba9822e88eb6628fb0a82fccaffd25
+++ libpurple/protocols/jabber/message.c	88445a96ee25c8f77af76525bc3253b809ee3eeb
@@ -296,7 +296,6 @@ static void handle_buzz(JabberMessage *j
 }
 
 static void handle_buzz(JabberMessage *jm) {
-	PurpleBuddy *buddy;
 	PurpleAccount *account;
 
 	/* Delayed buzz MUST NOT be accepted */
@@ -309,7 +308,7 @@ static void handle_buzz(JabberMessage *j
 
 	account = purple_connection_get_account(jm->js->gc);
 
-	if ((buddy = purple_find_buddy(account, jm->from)) == NULL)
+	if (purple_find_buddy(account, jm->from) == NULL)
 		return; /* Do not accept buzzes from unknown people */
 
 	/* xmpp only has 1 attention type, so index is 0 */
============================================================
--- libpurple/protocols/jabber/si.c	77b6923281f634d015a7ca41d4ec705f2b1a7ca6
+++ libpurple/protocols/jabber/si.c	92ed6a726f7863b90fc133ab8a07089f9833a5ac
@@ -1734,7 +1734,7 @@ void jabber_si_parse(JabberStream *js, c
 	/* if they've already sent us this file transfer with the same damn id
 	 * then we're gonna ignore it, until I think of something better to do
 	 * with it */
-	if((xfer = jabber_si_xfer_find(js, stream_id, from)))
+	if(jabber_si_xfer_find(js, stream_id, from) != NULL)
 		return;
 
 	jsx = g_new0(JabberSIXfer, 1);
============================================================
--- libpurple/protocols/jabber/disco.c	286a227929ab79f327026aed65bcc9d1adf1a13c
+++ libpurple/protocols/jabber/disco.c	c2ee571b066a3c7dd1f7a769ef68b27219ccc052
@@ -604,7 +604,7 @@ jabber_disco_server_items_result_cb(Jabb
 
 		/* we don't actually care about the specific nodes,
 		 * so we won't query them */
-		if((node = xmlnode_get_attrib(child, "node")))
+		if(xmlnode_get_attrib(child, "node") != NULL)
 			continue;
 
 		iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO);
============================================================
--- libpurple/protocols/bonjour/jabber.c	df92cb312fe76a58419c5f3169a485481650a4a1
+++ libpurple/protocols/bonjour/jabber.c	8d3d8f420b2ea8c19da007c2aea6f669f353b31e
@@ -1273,7 +1273,6 @@ xep_iq_parse(xmlnode *packet, PurpleBudd
 static void
 xep_iq_parse(xmlnode *packet, PurpleBuddy *pb)
 {
-	xmlnode *child;
 	PurpleAccount *account;
 	PurpleConnection *gc;
 
@@ -1283,7 +1282,7 @@ xep_iq_parse(xmlnode *packet, PurpleBudd
 		account = purple_buddy_get_account(pb);
 		gc = purple_account_get_connection(account);
 
-	if ((child = xmlnode_get_child(packet, "si")) || (child = xmlnode_get_child(packet, "error")))
+	if (xmlnode_get_child(packet, "si") != NULL || xmlnode_get_child(packet, "error") != NULL)
 		xep_si_parse(gc, packet, pb);
 	else
 		xep_bytestreams_parse(gc, packet, pb);
============================================================
--- libpurple/plugins/tcl/tcl_cmd.c	8a109a5402e98753148b56148cec51ec26948e73
+++ libpurple/plugins/tcl/tcl_cmd.c	f7a87fcf2e274f17de4881ed1260160880747f28
@@ -125,7 +125,7 @@ static PurpleCmdRet tcl_cmd_callback(Pur
                                    gchar **args, gchar **errors,
                                    struct tcl_cmd_handler *handler)
 {
-	int retval, error, i;
+	int retval, i;
 	Tcl_Obj *command, *arg, *tclargs, *result;
 
 	command = Tcl_NewListObj(0, NULL);
@@ -153,8 +153,7 @@ static PurpleCmdRet tcl_cmd_callback(Pur
 	}
 	Tcl_ListObjAppendElement(handler->interp, command, tclargs);
 
-	if ((error = Tcl_EvalObjEx(handler->interp, command,
-	                           TCL_EVAL_GLOBAL)) != TCL_OK) {
+	if (Tcl_EvalObjEx(handler->interp, command, TCL_EVAL_GLOBAL) != TCL_OK) {
 		gchar *errorstr;
 
 		errorstr = g_strdup_printf("error evaluating callback: %s\n",
@@ -164,8 +163,8 @@ static PurpleCmdRet tcl_cmd_callback(Pur
 		retval = PURPLE_CMD_RET_FAILED;
 	} else {
 		result = Tcl_GetObjResult(handler->interp);
-		if ((error = Tcl_GetIntFromObj(handler->interp, result,
-		                               &retval)) != TCL_OK) {
+		if (Tcl_GetIntFromObj(handler->interp, result,
+		                      &retval) != TCL_OK) {
 			gchar *errorstr;
 
 			errorstr = g_strdup_printf("Error retreiving procedure result: %s\n",
============================================================
--- finch/libgnt/gntentry.c	bcbefbbcf1d1b9f96b54dd0991043c00101085e2
+++ finch/libgnt/gntentry.c	1879daf21a22bd1a8f02d44952e637813f05c646
@@ -480,7 +480,7 @@ history_search(GntBindable *bind, GList 
 {
 	GntEntry *entry = GNT_ENTRY(bind);
 	GList *iter;
-	const char *current , *pos;
+	const char *current;
 	int len;
 	
 	if (entry->history->prev && entry->search->needle)
@@ -497,7 +497,7 @@ history_search(GntBindable *bind, GList 
 		const char *str = iter->data;
 		/* A more utf8-friendly version of strstr would have been better, but
 		 * for now, this will have to do. */
-		if ((pos = strstr(str, current)))
+		if (strstr(str, current) != NULL)
 			break;
 	}
 
============================================================
--- libpurple/protocols/qq/qq.c	555e549265519d242352127d645f43a5054f88b3
+++ libpurple/protocols/qq/qq.c	b1ac2a0a8f80d6fbe9a44207b8580a5a6fd17354
@@ -382,12 +382,10 @@ static const char *qq_list_emblem(Purple
 {
 	PurpleAccount *account;
 	PurpleConnection *gc;
-	qq_data *qd;
 	qq_buddy_data *buddy;
 
 	if (!b || !(account = purple_buddy_get_account(b)) ||
-		!(gc = purple_account_get_connection(account)) ||
-		!(qd = purple_connection_get_protocol_data(gc)))
+		!(gc = purple_account_get_connection(account)))
 		return NULL;
 
 	buddy = purple_buddy_get_protocol_data(b);
============================================================
--- finch/libgnt/gnttextview.c	96936723d96661f1aab7605c0f3accc04ec14c9a
+++ finch/libgnt/gnttextview.c	0de28872b5233f96c03e420a4d1221feb7b2b857
@@ -711,7 +711,7 @@ int gnt_text_view_get_lines_above(GntTex
 int gnt_text_view_get_lines_above(GntTextView *view)
 {
 	int above = 0;
-	GList *list = view->list;
+	GList *list;
 	list = g_list_nth(view->list, GNT_WIDGET(view)->priv.height);
 	if (!list)
 		return 0;
============================================================
--- pidgin/plugins/xmppconsole.c	ed14baf080859bd25c58c7ef3b825ba3f0d1d136
+++ pidgin/plugins/xmppconsole.c	f93483d776358849885f54366f68035dd30aa22e
@@ -183,7 +183,7 @@ static void message_send_cb(GtkWidget *w
 {
 	GtkTextIter start, end;
 	PurplePluginProtocolInfo *prpl_info = NULL;
-	PurpleConnection *gc = console->gc;
+	PurpleConnection *gc;
 	GtkTextBuffer *buffer;
 	char *text;
 
============================================================
--- libpurple/protocols/bonjour/mdns_avahi.c	00340f6b687dd942e968b3a514cb38a83bcfb04c
+++ libpurple/protocols/bonjour/mdns_avahi.c	54adfbf2bf7c05d8d9be7e5d3373e42ac1f0f996
@@ -115,7 +115,6 @@ _resolver_callback(AvahiServiceResolver 
 	AvahiStringList *l;
 	size_t size;
 	char *key, *value;
-	int ret;
 	char ip[AVAHI_ADDRESS_STR_MAX];
 	AvahiBuddyImplData *b_impl;
 	AvahiSvcResolverData *rd;
@@ -202,7 +201,7 @@ _resolver_callback(AvahiServiceResolver 
 			/* Obtain the parameters from the text_record */
 			clear_bonjour_buddy_values(bb);
 			for(l = txt; l != NULL; l = l->next) {
-				if ((ret = avahi_string_list_get_pair(l, &key, &value, &size)) < 0)
+				if (avahi_string_list_get_pair(l, &key, &value, &size) < 0)
 					continue;
 				set_bonjour_buddy_value(bb, key, value, size);
 				/* TODO: Since we're using the glib allocator, I think we
============================================================
--- libpurple/protocols/qq/qq_trans.c	16389a8403567a22eb2682501b61a909b3e7139c
+++ libpurple/protocols/qq/qq_trans.c	98eeaef56ad19b708ae9aa57dc0710d6487a26a0
@@ -138,10 +138,11 @@ static void trans_remove(PurpleConnectio
 /* Remove a packet with seq from send trans */
 static void trans_remove(PurpleConnection *gc, qq_transaction *trans)
 {
-	qq_data *qd = (qq_data *)gc->proto_data;
+	qq_data *qd;
 
-	g_return_if_fail(gc != NULL && gc->proto_data != NULL);
+	g_return_if_fail(gc != NULL);
 	qd = (qq_data *) gc->proto_data;
+	g_return_if_fail(qd != NULL);
 
 	g_return_if_fail(trans != NULL);
 #if 0
============================================================
--- libpurple/protocols/jabber/bosh.c	9be4bd5785e2bc92d35f1fbe83149679332abce5
+++ libpurple/protocols/jabber/bosh.c	4b15a6c4a0b2d82995f87820a112f0df045f11f4
@@ -711,11 +711,10 @@ jabber_bosh_http_connection_process(Purp
 		/* Make sure Content-Length is in headers, not body */
 		if (content_length && (!end_of_headers || content_length < end_of_headers)) {
 			const char *sep;
-			const char *eol;
 			int len;
 
 			if ((sep = strstr(content_length, ": ")) == NULL ||
-					(eol = strstr(sep, "\r\n")) == NULL)
+					strstr(sep, "\r\n") == NULL)
 				/*
 				 * The packet ends in the middle of the Content-Length line.
 				 * We'll try again later when we have more.


More information about the Commits mailing list