/pidgin/main: eb88fd4cbced: Remove various array comparisons to ...

Daniel Atallah datallah at pidgin.im
Sun Feb 24 22:21:42 EST 2013


Changeset: eb88fd4cbcedc939bc1dbf7b2a86193f83adceaf
Author:	 Daniel Atallah <datallah at pidgin.im>
Date:	 2013-02-24 22:21 -0500
Branch:	 release-2.x.y
URL: https://hg.pidgin.im/pidgin/main/rev/eb88fd4cbced

Description:

Remove various array comparisons to NULL because they're silly

diffstat:

 libpurple/protocols/mxit/login.c    |   2 +-
 libpurple/protocols/silc/buddy.c    |   9 +++------
 libpurple/protocols/silc/ops.c      |  14 +++++---------
 libpurple/protocols/zephyr/zephyr.c |  10 ++++------
 4 files changed, 13 insertions(+), 22 deletions(-)

diffs (90 lines):

diff --git a/libpurple/protocols/mxit/login.c b/libpurple/protocols/mxit/login.c
--- a/libpurple/protocols/mxit/login.c
+++ b/libpurple/protocols/mxit/login.c
@@ -743,7 +743,7 @@ void mxit_login( PurpleAccount* account 
 	 * if we don't have any info saved from a previous login, we need to get it from the MXit WAP site.
 	 * we do cache it, so this step is only done on the very first login for each account.
 	 */
-	if ( ( session->distcode == NULL ) || ( strlen( session->distcode ) == 0 ) ) {
+	if ( strlen( session->distcode ) == 0 ) {
 		/* this must be the very first login, so we need to retrieve the user information */
 		get_clientinfo( session );
 	}
diff --git a/libpurple/protocols/silc/buddy.c b/libpurple/protocols/silc/buddy.c
--- a/libpurple/protocols/silc/buddy.c
+++ b/libpurple/protocols/silc/buddy.c
@@ -1546,13 +1546,10 @@ void silcpurple_tooltip_text(PurpleBuddy
 	if (!client_entry)
 		return;
 
-	if (client_entry->nickname)
-		purple_notify_user_info_add_pair(user_info, _("Nickname"),
+	purple_notify_user_info_add_pair(user_info, _("Nickname"),
 					       client_entry->nickname);
-	if (client_entry->username && client_entry->hostname) {
-		g_snprintf(tmp, sizeof(tmp), "%s@%s", client_entry->username, client_entry->hostname);
-		purple_notify_user_info_add_pair(user_info, _("Username"), tmp);
-	}
+	g_snprintf(tmp, sizeof(tmp), "%s@%s", client_entry->username, client_entry->hostname);
+	purple_notify_user_info_add_pair(user_info, _("Username"), tmp);
 	if (client_entry->mode) {
 		memset(tmp, 0, sizeof(tmp));
 		silcpurple_get_umode_string(client_entry->mode,
diff --git a/libpurple/protocols/silc/ops.c b/libpurple/protocols/silc/ops.c
--- a/libpurple/protocols/silc/ops.c
+++ b/libpurple/protocols/silc/ops.c
@@ -214,13 +214,10 @@ silcpurple_mime_message(SilcClient clien
 
 			if (channel)
 				serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)),
-				 		 sender->nickname ?
-				 		  sender->nickname :
-						 "<unknown>", cflags,
+				 		 sender->nickname, cflags,
 						 tmp, time(NULL));
 			else
-				serv_got_im(gc, sender->nickname ?
-					    sender->nickname : "<unknown>",
+				serv_got_im(gc, sender->nickname,
 					    tmp, cflags, time(NULL));
 
 			purple_imgstore_unref_by_id(imgid);
@@ -362,15 +359,14 @@ silc_private_message(SilcClient client, 
 {
 	PurpleConnection *gc = client->application;
 	SilcPurple sg = gc->proto_data;
-	PurpleConversation *convo = NULL;
+	PurpleConversation *convo;
 	char *msg, *tmp;
 
 	if (!message)
 		return;
 
-	if (sender->nickname)
-		/* XXX - Should this be PURPLE_CONV_TYPE_IM? */
-		convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY,
+	/* XXX - Should this be PURPLE_CONV_TYPE_IM? */
+	convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY,
 							      sender->nickname, sg->account);
 
 	if (flags & SILC_MESSAGE_FLAG_SIGNED &&
diff --git a/libpurple/protocols/zephyr/zephyr.c b/libpurple/protocols/zephyr/zephyr.c
--- a/libpurple/protocols/zephyr/zephyr.c
+++ b/libpurple/protocols/zephyr/zephyr.c
@@ -927,12 +927,10 @@ static int  free_parse_tree(parse_tree* 
 	}
 	else {
 		int i;
-		if (tree->children) {
-			for(i=0;i<tree->num_children;i++){
-				if (tree->children[i]) {
-					free_parse_tree(tree->children[i]);
-					g_free(tree->children[i]);
-				}
+		for(i=0;i<tree->num_children;i++){
+			if (tree->children[i]) {
+				free_parse_tree(tree->children[i]);
+				g_free(tree->children[i]);
 			}
 		}
 		if ((tree != &null_parse_tree) && (tree->contents != NULL))



More information about the Commits mailing list