From 0b812f31925f2ed50eb54d2be6ac9291bf67b890 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Fri, 21 Oct 2016 16:07:45 +0300 Subject: char: use a const CharDriver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Eric Blake Signed-off-by: Paolo Bonzini --- ui/console.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'ui') diff --git a/ui/console.c b/ui/console.c index b9575f2ee5..e4bb22fe87 100644 --- a/ui/console.c +++ b/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); -- cgit v1.2.3