console: allow con==NULL in dpy_{get, set}_ui_info and dpy_ui_info_supported

Use active_console in that case like we do in many other places.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-id: 20201208115737.18581-3-kraxel@redhat.com
master
Gerd Hoffmann 2020-12-08 12:57:30 +01:00
parent c7b22c0a7c
commit 5c4b107f88
1 changed files with 10 additions and 2 deletions

View File

@ -1544,19 +1544,27 @@ static void dpy_set_ui_info_timer(void *opaque)
bool dpy_ui_info_supported(QemuConsole *con) bool dpy_ui_info_supported(QemuConsole *con)
{ {
if (con == NULL) {
con = active_console;
}
return con->hw_ops->ui_info != NULL; return con->hw_ops->ui_info != NULL;
} }
const QemuUIInfo *dpy_get_ui_info(const QemuConsole *con) const QemuUIInfo *dpy_get_ui_info(const QemuConsole *con)
{ {
assert(con != NULL); if (con == NULL) {
con = active_console;
}
return &con->ui_info; return &con->ui_info;
} }
int dpy_set_ui_info(QemuConsole *con, QemuUIInfo *info) int dpy_set_ui_info(QemuConsole *con, QemuUIInfo *info)
{ {
assert(con != NULL); if (con == NULL) {
con = active_console;
}
if (!dpy_ui_info_supported(con)) { if (!dpy_ui_info_supported(con)) {
return -1; return -1;