mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
readline: decouple readline from the monitor
Make the readline.c functionality reusable. Instead of calling monitor_printf() and monitor_flush() directly, invoke function pointers provided by the user. This way readline.c does not know about Monitor and other users will be able to make use of readline.c. Note that there is already an "opaque" argument to the ReadLineFunc callback. Consistently call it "readline_opaque" from now on to distinguish from the ReadLinePrintfFunc/ReadLineFlushFunc "opaque" argument. I also dropped the printf macro trickery since it's now highly unlikely that anyone modifying readline.c would call printf(3) directly. We no longer need this protection. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
585ea0c841
commit
c60bf3391b
4 changed files with 71 additions and 38 deletions
6
hmp.c
6
hmp.c
|
@ -1092,11 +1092,11 @@ void hmp_eject(Monitor *mon, const QDict *qdict)
|
|||
hmp_handle_error(mon, &err);
|
||||
}
|
||||
|
||||
static void hmp_change_read_arg(Monitor *mon, const char *password,
|
||||
void *opaque)
|
||||
static void hmp_change_read_arg(void *opaque, const char *password,
|
||||
void *readline_opaque)
|
||||
{
|
||||
qmp_change_vnc_password(password, NULL);
|
||||
monitor_read_command(mon, 1);
|
||||
monitor_read_command(opaque, 1);
|
||||
}
|
||||
|
||||
void hmp_change(Monitor *mon, const QDict *qdict)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue