[iortcw] 398/497: All: Early out of Cmd_CompleteArgument and Cmd_SetCommandCompletionFunc

Simon McVittie smcv at debian.org
Fri Sep 8 10:37:35 UTC 2017


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to annotated tag 1.42d
in repository iortcw.

commit 8f91861fb6594bf718e8e6522d8e493c61345e87
Author: MAN-AT-ARMS <M4N4T4RMS at gmail.com>
Date:   Mon Sep 21 11:06:14 2015 -0400

    All: Early out of Cmd_CompleteArgument and Cmd_SetCommandCompletionFunc
---
 MP/code/qcommon/cmd.c | 8 ++++++--
 SP/code/qcommon/cmd.c | 8 ++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/MP/code/qcommon/cmd.c b/MP/code/qcommon/cmd.c
index 136b1fd..f6d49ea 100644
--- a/MP/code/qcommon/cmd.c
+++ b/MP/code/qcommon/cmd.c
@@ -661,6 +661,7 @@ void Cmd_SetCommandCompletionFunc( const char *command, completionFunc_t complet
 	for( cmd = cmd_functions; cmd; cmd = cmd->next ) {
 		if( !Q_stricmp( command, cmd->name ) ) {
 			cmd->complete = complete;
+			return;
 		}
 	}
 }
@@ -737,8 +738,11 @@ void Cmd_CompleteArgument( const char *command, char *args, int argNum ) {
 	cmd_function_t	*cmd;
 
 	for( cmd = cmd_functions; cmd; cmd = cmd->next ) {
-		if( !Q_stricmp( command, cmd->name ) && cmd->complete ) {
-			cmd->complete( args, argNum );
+		if( !Q_stricmp( command, cmd->name ) ) {
+			if ( cmd->complete ) {
+				cmd->complete( args, argNum );
+			}
+			return;
 		}
 	}
 }
diff --git a/SP/code/qcommon/cmd.c b/SP/code/qcommon/cmd.c
index 86b4423..cf91a60 100644
--- a/SP/code/qcommon/cmd.c
+++ b/SP/code/qcommon/cmd.c
@@ -663,6 +663,7 @@ void Cmd_SetCommandCompletionFunc( const char *command, completionFunc_t complet
 	for( cmd = cmd_functions; cmd; cmd = cmd->next ) {
 		if( !Q_stricmp( command, cmd->name ) ) {
 			cmd->complete = complete;
+			return;
 		}
 	}
 }
@@ -739,8 +740,11 @@ void Cmd_CompleteArgument( const char *command, char *args, int argNum ) {
 	cmd_function_t	*cmd;
 
 	for( cmd = cmd_functions; cmd; cmd = cmd->next ) {
-		if( !Q_stricmp( command, cmd->name ) && cmd->complete ) {
-			cmd->complete( args, argNum );
+		if( !Q_stricmp( command, cmd->name ) ) {
+			if ( cmd->complete ) {
+				cmd->complete( args, argNum );
+			}
+			return;
 		}
 	}
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git



More information about the Pkg-games-commits mailing list