changeset 30413:7c871249318b

Fix some "Dead nested assignment"s and then kill off some useless variables related to them.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sat, 14 Aug 2010 05:17:38 +0000
parents 41906308232b
children 77449a80fef2
files finch/libgnt/gntentry.c finch/libgnt/gnttextview.c libpurple/log.c libpurple/plugins/tcl/tcl_cmd.c libpurple/plugins/tcl/tcl_signals.c libpurple/protocols/bonjour/jabber.c libpurple/protocols/bonjour/mdns_avahi.c libpurple/protocols/jabber/bosh.c libpurple/protocols/jabber/disco.c libpurple/protocols/jabber/message.c libpurple/protocols/jabber/si.c libpurple/protocols/qq/qq.c libpurple/protocols/qq/qq_trans.c libpurple/protocols/yahoo/libymsg.c libpurple/protocols/yahoo/yahoochat.c libpurple/proxy.c pidgin/gtkblist.c pidgin/gtkutils.c pidgin/plugins/xmppconsole.c
diffstat 19 files changed, 34 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
--- a/finch/libgnt/gntentry.c	Sat Aug 14 03:55:19 2010 +0000
+++ b/finch/libgnt/gntentry.c	Sat Aug 14 05:17:38 2010 +0000
@@ -480,7 +480,7 @@
 {
 	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 @@
 		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;
 	}
 
--- a/finch/libgnt/gnttextview.c	Sat Aug 14 03:55:19 2010 +0000
+++ b/finch/libgnt/gnttextview.c	Sat Aug 14 05:17:38 2010 +0000
@@ -711,7 +711,7 @@
 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;
--- a/libpurple/log.c	Sat Aug 14 03:55:19 2010 +0000
+++ b/libpurple/log.c	Sat Aug 14 05:17:38 2010 +0000
@@ -1681,7 +1681,6 @@
 	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 @@
 	}
 
 	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];
--- a/libpurple/plugins/tcl/tcl_cmd.c	Sat Aug 14 03:55:19 2010 +0000
+++ b/libpurple/plugins/tcl/tcl_cmd.c	Sat Aug 14 05:17:38 2010 +0000
@@ -125,7 +125,7 @@
                                    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 @@
 	}
 	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 @@
 		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",
--- a/libpurple/plugins/tcl/tcl_signals.c	Sat Aug 14 03:55:19 2010 +0000
+++ b/libpurple/plugins/tcl/tcl_signals.c	Sat Aug 14 05:17:38 2010 +0000
@@ -160,7 +160,7 @@
 {
 	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 @@
 	}
 
 	/* 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 @@
 			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;
--- a/libpurple/protocols/bonjour/jabber.c	Sat Aug 14 03:55:19 2010 +0000
+++ b/libpurple/protocols/bonjour/jabber.c	Sat Aug 14 05:17:38 2010 +0000
@@ -1273,7 +1273,6 @@
 static void
 xep_iq_parse(xmlnode *packet, PurpleBuddy *pb)
 {
-	xmlnode *child;
 	PurpleAccount *account;
 	PurpleConnection *gc;
 
@@ -1283,7 +1282,7 @@
 		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);
--- a/libpurple/protocols/bonjour/mdns_avahi.c	Sat Aug 14 03:55:19 2010 +0000
+++ b/libpurple/protocols/bonjour/mdns_avahi.c	Sat Aug 14 05:17:38 2010 +0000
@@ -115,7 +115,6 @@
 	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 @@
 			/* 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
--- a/libpurple/protocols/jabber/bosh.c	Sat Aug 14 03:55:19 2010 +0000
+++ b/libpurple/protocols/jabber/bosh.c	Sat Aug 14 05:17:38 2010 +0000
@@ -711,11 +711,10 @@
 		/* 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.
--- a/libpurple/protocols/jabber/disco.c	Sat Aug 14 03:55:19 2010 +0000
+++ b/libpurple/protocols/jabber/disco.c	Sat Aug 14 05:17:38 2010 +0000
@@ -604,7 +604,7 @@
 
 		/* 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);
--- a/libpurple/protocols/jabber/message.c	Sat Aug 14 03:55:19 2010 +0000
+++ b/libpurple/protocols/jabber/message.c	Sat Aug 14 05:17:38 2010 +0000
@@ -296,7 +296,6 @@
 }
 
 static void handle_buzz(JabberMessage *jm) {
-	PurpleBuddy *buddy;
 	PurpleAccount *account;
 
 	/* Delayed buzz MUST NOT be accepted */
@@ -309,7 +308,7 @@
 
 	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 */
--- a/libpurple/protocols/jabber/si.c	Sat Aug 14 03:55:19 2010 +0000
+++ b/libpurple/protocols/jabber/si.c	Sat Aug 14 05:17:38 2010 +0000
@@ -1734,7 +1734,7 @@
 	/* 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);
--- a/libpurple/protocols/qq/qq.c	Sat Aug 14 03:55:19 2010 +0000
+++ b/libpurple/protocols/qq/qq.c	Sat Aug 14 05:17:38 2010 +0000
@@ -382,12 +382,10 @@
 {
 	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);
--- a/libpurple/protocols/qq/qq_trans.c	Sat Aug 14 03:55:19 2010 +0000
+++ b/libpurple/protocols/qq/qq_trans.c	Sat Aug 14 05:17:38 2010 +0000
@@ -138,10 +138,11 @@
 /* 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
--- a/libpurple/protocols/yahoo/libymsg.c	Sat Aug 14 03:55:19 2010 +0000
+++ b/libpurple/protocols/yahoo/libymsg.c	Sat Aug 14 05:17:38 2010 +0000
@@ -502,8 +502,6 @@
 	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 @@
 				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 @@
 	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 @@
 				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 @@
 {
 	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));
--- a/libpurple/protocols/yahoo/yahoochat.c	Sat Aug 14 03:55:19 2010 +0000
+++ b/libpurple/protocols/yahoo/yahoochat.c	Sat Aug 14 05:17:38 2010 +0000
@@ -121,7 +121,6 @@
 	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 @@
 		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 @@
 {
 	YahooData *yd = gc->proto_data;
 	struct yahoo_packet *pkt;
-	PurpleConversation *c;
 
 	char *eroom;
 	gboolean utf8 = 1;
@@ -905,7 +903,7 @@
 		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)
--- a/libpurple/proxy.c	Sat Aug 14 03:55:19 2010 +0000
+++ b/libpurple/proxy.c	Sat Aug 14 05:17:38 2010 +0000
@@ -1023,7 +1023,7 @@
 
 				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;
 
--- a/pidgin/gtkblist.c	Sat Aug 14 03:55:19 2010 +0000
+++ b/pidgin/gtkblist.c	Sat Aug 14 05:17:38 2010 +0000
@@ -3168,7 +3168,6 @@
 	} 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)
 		{
--- a/pidgin/gtkutils.c	Sat Aug 14 03:55:19 2010 +0000
+++ b/pidgin/gtkutils.c	Sat Aug 14 05:17:38 2010 +0000
@@ -1036,7 +1036,7 @@
 	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 @@
 		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);
--- a/pidgin/plugins/xmppconsole.c	Sat Aug 14 03:55:19 2010 +0000
+++ b/pidgin/plugins/xmppconsole.c	Sat Aug 14 05:17:38 2010 +0000
@@ -183,7 +183,7 @@
 {
 	GtkTextIter start, end;
 	PurplePluginProtocolInfo *prpl_info = NULL;
-	PurpleConnection *gc = console->gc;
+	PurpleConnection *gc;
 	GtkTextBuffer *buffer;
 	char *text;