diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-12-27 20:03:07 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-12-27 20:03:07 +0000 |
commit | e5eef156904dce79231ad20df1c530915cfa3d1d (patch) | |
tree | 743b681a8c58dfdf6f39440d005d2416e5d13250 /pbx.c | |
parent | 64632fcfa82afe74d9420b60872fa58841d35004 (diff) |
minor cleanups for another cli completion function ...
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@7661 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx.c')
-rw-r--r-- | pbx.c | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -1196,10 +1196,9 @@ static int handle_show_function(int fd, int argc, char *argv[]) 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 @@ static char *complete_show_function(char *line, char *word, int pos, int state) 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) |