[svn-commits] trunk - r7655 /trunk/asterisk.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Tue Dec 27 11:24:55 CST 2005


Author: russell
Date: Tue Dec 27 11:24:54 2005
New Revision: 7655

URL: http://svn.digium.com/view/asterisk?rev=7655&view=rev
Log:
when doing tab completion, iterate the list of matches to count how many there
are instead of having the list of matches generated twice (issue #6066)

Modified:
    trunk/asterisk.c

Modified: trunk/asterisk.c
URL: http://svn.digium.com/view/asterisk/trunk/asterisk.c?rev=7655&r1=7654&r2=7655&view=diff
==============================================================================
--- trunk/asterisk.c (original)
+++ trunk/asterisk.c Tue Dec 27 11:24:54 2005
@@ -1602,12 +1602,13 @@
 			free(mbuf);
 		} else
 			matches = (char **) NULL;
-
-
 	} else {
-
-		nummatches = ast_cli_generatornummatches((char *)lf->buffer,ptr);
+		char **p;
+		int count = 0;
 		matches = ast_cli_completion_matches((char *)lf->buffer,ptr);
+		for (p = matches; p && *p; p++)
+			count++;
+		nummatches = count - 1; /* XXX apparently there is one dup ? */
 	}
 
 	if (matches) {
@@ -1641,7 +1642,7 @@
 				retval = CC_REFRESH;
 			}
 		}
-	free(matches);
+		free(matches);
 	}
 
 	return (char *)(long)retval;



More information about the svn-commits mailing list