mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-13 00:04:53 +00:00
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) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7655 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
11
asterisk.c
11
asterisk.c
@@ -1602,12 +1602,13 @@ static char *cli_complete(EditLine *el, int ch)
|
|||||||
free(mbuf);
|
free(mbuf);
|
||||||
} else
|
} else
|
||||||
matches = (char **) NULL;
|
matches = (char **) NULL;
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
char **p;
|
||||||
nummatches = ast_cli_generatornummatches((char *)lf->buffer,ptr);
|
int count = 0;
|
||||||
matches = ast_cli_completion_matches((char *)lf->buffer,ptr);
|
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) {
|
if (matches) {
|
||||||
@@ -1641,7 +1642,7 @@ static char *cli_complete(EditLine *el, int ch)
|
|||||||
retval = CC_REFRESH;
|
retval = CC_REFRESH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(matches);
|
free(matches);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (char *)(long)retval;
|
return (char *)(long)retval;
|
||||||
|
Reference in New Issue
Block a user