mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
readline: Extract readline_add_completion_of() from monitor
monitor/misc.h has static add_completion_option(). It's useful elsewhere in the monitor. Since it's not monitor-specific, move it to util/readline.c renamed to readline_add_completion_of(), and put it to use. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20230124121946.1139465-7-armbru@redhat.com>
This commit is contained in:
parent
444ee02c5f
commit
52f50b1e9f
4 changed files with 41 additions and 66 deletions
|
@ -286,6 +286,14 @@ void readline_add_completion(ReadLineState *rs, const char *str)
|
|||
}
|
||||
}
|
||||
|
||||
void readline_add_completion_of(ReadLineState *rs,
|
||||
const char *pfx, const char *str)
|
||||
{
|
||||
if (!strncmp(str, pfx, strlen(pfx))) {
|
||||
readline_add_completion(rs, str);
|
||||
}
|
||||
}
|
||||
|
||||
void readline_set_completion_index(ReadLineState *rs, int index)
|
||||
{
|
||||
rs->completion_index = index;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue