[asterisk-commits] rizzo: trunk r47537 - /trunk/main/cli.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Nov 13 05:04:06 MST 2006


Author: rizzo
Date: Mon Nov 13 06:04:05 2006
New Revision: 47537

URL: http://svn.digium.com/view/asterisk?view=rev&rev=47537
Log:
stop looking for new entries when we know we are done.

there is no functional change, so it is not necessary to
bother merging this to 1.4 now.


Modified:
    trunk/main/cli.c

Modified: trunk/main/cli.c
URL: http://svn.digium.com/view/asterisk/trunk/main/cli.c?view=diff&rev=47537&r1=47536&r2=47537
==============================================================================
--- trunk/main/cli.c (original)
+++ trunk/main/cli.c Mon Nov 13 06:04:05 2006
@@ -1622,17 +1622,21 @@
 	}
 	if (lock)
 		AST_LIST_LOCK(&helpers);
-	while( !ret && (e = cli_next(&i)) ) {
+	while ((e = cli_next(&i))) {
 		int lc = strlen(e->_full_cmd);
 		if (e->_full_cmd[0] != '_' && lc > 0 && matchlen <= lc &&
 				!strncasecmp(matchstr, e->_full_cmd, matchlen)) {
 			/* Found initial part, return a copy of the next word... */
-			if (e->cmda[argindex] && ++matchnum > state)
+			if (e->cmda[argindex] && ++matchnum > state) {
 				ret = strdup(e->cmda[argindex]); /* we need a malloced string */
-		} else if (e->generator && !strncasecmp(matchstr, e->_full_cmd, lc) && matchstr[lc] < 33) {
+				break;
+			}
+		} else if (!strncasecmp(matchstr, e->_full_cmd, lc) && matchstr[lc] < 33) {
 			/* We have a command in its entirity within us -- theoretically only one
 			   command can have this occur */
-			ret = e->generator(matchstr, word, argindex, state);
+			if (e->generator)
+				ret = e->generator(matchstr, word, argindex, state);
+			break;
 		}
 	}
 	if (lock)



More information about the asterisk-commits mailing list