pidgin: f005961a: Simplify. A lot of these checks aren't ...

markdoliner at pidgin.im markdoliner at pidgin.im
Wed Aug 12 22:39:59 EDT 2009


-----------------------------------------------------------------
Revision: f005961acc673854916055d8bc491c28f9fb63f0
Ancestor: 9cce7522e5d3182c075715ac5d4ec375672cd1b0
Author: markdoliner at pidgin.im
Date: 2009-08-13T02:32:33
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/f005961acc673854916055d8bc491c28f9fb63f0

Modified files:
        libpurple/protocols/msn/cmdproc.c

ChangeLog: 

Simplify.  A lot of these checks aren't necessary because msn_table_new()
always creates these hash tables.

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/cmdproc.c	16173c7d5f2918eb4fe9b75297dffa0cdcf84e1c
+++ libpurple/protocols/msn/cmdproc.c	8588a6864ee7a819600d6871f05745d9224ff2c9
@@ -333,49 +333,38 @@ msn_cmdproc_process_cmd(MsnCmdProc *cmdp
 			trans->timer = 0;
 		}
 
-	if (g_ascii_isdigit(cmd->command[0]))
+	if (g_ascii_isdigit(cmd->command[0]) && trans != NULL)
 	{
-		if (trans != NULL)
-		{
-			MsnErrorCb error_cb;
-			int error;
+		MsnErrorCb error_cb;
+		int error;
 
-			error = atoi(cmd->command);
+		error = atoi(cmd->command);
 
-			error_cb = trans->error_cb;
-			if (error_cb == NULL)
-				error_cb = g_hash_table_lookup(cmdproc->cbs_table->errors, trans->command);
+		error_cb = trans->error_cb;
+		if (error_cb == NULL)
+			error_cb = g_hash_table_lookup(cmdproc->cbs_table->errors, trans->command);
 
-			if (error_cb != NULL)
-				error_cb(cmdproc, trans, error);
-			else
-				msn_error_handle(cmdproc->session, error);
+		if (error_cb != NULL)
+			error_cb(cmdproc, trans, error);
+		else
+			msn_error_handle(cmdproc->session, error);
 
-			return;
-		}
+		return;
 	}
 
-	if (cmdproc->cbs_table->async != NULL)
-		cb = g_hash_table_lookup(cmdproc->cbs_table->async, cmd->command);
+	cb = g_hash_table_lookup(cmdproc->cbs_table->async, cmd->command);
 
-	if (cb == NULL && trans != NULL)
-	{
-		if (trans->callbacks != NULL)
-			cb = g_hash_table_lookup(trans->callbacks, cmd->command);
-	}
+	if (cb == NULL && trans != NULL && trans->callbacks != NULL)
+		cb = g_hash_table_lookup(trans->callbacks, cmd->command);
 
-	if (cb == NULL && cmdproc->cbs_table->fallback != NULL)
+	if (cb == NULL)
 		cb = g_hash_table_lookup(cmdproc->cbs_table->fallback, cmd->command);
 
 	if (cb != NULL)
-	{
 		cb(cmdproc, cmd);
-	}
 	else
-	{
 		purple_debug_warning("msn", "Unhandled command '%s'\n",
 						   cmd->command);
-	}
 
 	if (trans != NULL && trans->pendent_cmd != NULL)
 		msn_transaction_unqueue_cmd(trans, cmdproc);


More information about the Commits mailing list