[empathy: 11/12] Optimisation: Remove of the duplicated check for the command prefix.



commit e31c0e3f3b9a12dcf280a1ec05fc58463a020d71
Author: Xavier Claessens <xclaesse gmail com>
Date:   Tue Nov 3 17:11:07 2009 +0100

    Optimisation: Remove of the duplicated check for the command prefix.

 libempathy-gtk/empathy-chat.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
---
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index d8acd3b..cfeb007 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -690,7 +690,8 @@ chat_send (EmpathyChat  *chat,
 			GStrv strv;
 			guint strv_len;
 
-			if (!has_prefix_case (msg + 1, commands[i].prefix)) {
+			if (!has_prefix_case (msg + 1, commands[i].prefix) ||
+			    !g_ascii_isspace (msg + 1 + strlen (commands[i].prefix))) {
 				continue;
 			}
 
@@ -699,11 +700,6 @@ chat_send (EmpathyChat  *chat,
 			 * between args */
 			strv = chat_command_parse (msg + 1, commands[i].max_parts);
 
-			if (g_ascii_strcasecmp (strv[0], commands[i].prefix) != 0) {
-				g_strfreev (strv);
-				continue;
-			}
-
 			strv_len = g_strv_length (strv);
 			if (strv_len < commands[i].min_parts ||
 			    strv_len > commands[i].max_parts) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]