[asterisk-commits] trunk - r7661 /trunk/pbx.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Dec 27 14:03:08 CST 2005


Author: russell
Date: Tue Dec 27 14:03:07 2005
New Revision: 7661

URL: http://svn.digium.com/view/asterisk?rev=7661&view=rev
Log:
minor cleanups for another cli completion function ...

Modified:
    trunk/pbx.c

Modified: trunk/pbx.c
URL: http://svn.digium.com/view/asterisk/trunk/pbx.c?rev=7661&r1=7660&r2=7661&view=diff
==============================================================================
--- trunk/pbx.c (original)
+++ trunk/pbx.c Tue Dec 27 14:03:07 2005
@@ -1196,10 +1196,9 @@
 static char *complete_show_function(char *line, char *word, int pos, int state)
 {
 	struct ast_custom_function *acf;
+	char *ret = NULL;
 	int which = 0;
-	int wordlen;
-
-	wordlen = strlen(word);
+	int wordlen = strlen(word);
 
 	/* try to lock functions list ... */
 	if (ast_mutex_lock(&acflock)) {
@@ -1210,15 +1209,15 @@
 	for (acf = acf_root; acf; acf = acf->next) {
 		if (!strncasecmp(word, acf->name, wordlen)) {
 			if (++which > state) {
-				char *ret = strdup(acf->name);
-				ast_mutex_unlock(&acflock);
-				return ret;
+				ret = strdup(acf->name);
+				break;
 			}
 		}
 	}
 
 	ast_mutex_unlock(&acflock);
-	return NULL; 
+
+	return ret; 
 }
 
 struct ast_custom_function* ast_custom_function_find(const char *name) 



More information about the asterisk-commits mailing list