mirror of
https://github.com/mii443/qemu.git
synced 2025-12-16 17:18:49 +00:00
char: use a const CharDriver
No need to allocate & copy fields, let's use static const struct instead. Add an alias field to the CharDriver structure to cover the cases where we previously registered a driver twice under two names. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
committed by
Paolo Bonzini
parent
bd1caa3f8e
commit
0b812f3192
10
ui/console.c
10
ui/console.c
@@ -2191,12 +2191,16 @@ static const TypeInfo qemu_console_info = {
|
||||
.class_size = sizeof(QemuConsoleClass),
|
||||
};
|
||||
|
||||
|
||||
static void register_types(void)
|
||||
{
|
||||
static const CharDriver vc_driver = {
|
||||
.kind = CHARDEV_BACKEND_KIND_VC,
|
||||
.parse = qemu_chr_parse_vc,
|
||||
.create = vc_init,
|
||||
};
|
||||
|
||||
type_register_static(&qemu_console_info);
|
||||
register_char_driver("vc", CHARDEV_BACKEND_KIND_VC, qemu_chr_parse_vc,
|
||||
vc_init);
|
||||
register_char_driver(&vc_driver);
|
||||
}
|
||||
|
||||
type_init(register_types);
|
||||
|
||||
Reference in New Issue
Block a user