wordlen = strlen(word);
AST_RWLIST_RDLOCK(&acf_root);
AST_RWLIST_TRAVERSE(&acf_root, cur, acflist) {
- /* case-insensitive for convenience in this 'complete' function */
+ /*
+ * Do a case-insensitive search for convenience in this
+ * 'complete' function.
+ *
+ * We must search the entire container because the functions are
+ * sorted and normally found case sensitively.
+ */
cmp = strncasecmp(word, cur->name, wordlen);
- if (cmp > 0) {
- continue;
- }
if (!cmp) {
/* Found match. */
if (++which <= state) {
ret = ast_strdup(cur->name);
break;
}
- /* Not in container. */
- break;
}
AST_RWLIST_UNLOCK(&acf_root);
/* Store in alphabetical order */
AST_RWLIST_TRAVERSE_SAFE_BEGIN(&acf_root, cur, acflist) {
- if (strcasecmp(acf->name, cur->name) < 0) {
+ if (strcmp(acf->name, cur->name) < 0) {
AST_RWLIST_INSERT_BEFORE_CURRENT(acf, acflist);
break;
}