diff mbox series

[17/67] ui/console: use OBJECT_DEFINE_TYPE for QemuConsole

Message ID 20230830093843.3531473-18-marcandre.lureau@redhat.com
State New
Headers show
Series Make pixman an optional dependency | expand

Commit Message

Marc-André Lureau Aug. 30, 2023, 9:37 a.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

The following patch will move some object initialization to the
corresponding handlers.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 ui/console.c | 31 +++++++++++++++++--------------
 1 file changed, 17 insertions(+), 14 deletions(-)

Comments

Daniel P. Berrangé Aug. 30, 2023, 11:09 a.m. UTC | #1
On Wed, Aug 30, 2023 at 01:37:51PM +0400, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> The following patch will move some object initialization to the
> corresponding handlers.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  ui/console.c | 31 +++++++++++++++++--------------
>  1 file changed, 17 insertions(+), 14 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
diff mbox series

Patch

diff --git a/ui/console.c b/ui/console.c
index b9b545fa3d..7d0bb819ac 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -125,6 +125,8 @@  struct QemuConsole {
     QTAILQ_ENTRY(QemuConsole) next;
 };
 
+OBJECT_DEFINE_TYPE(QemuConsole, qemu_console, QEMU_CONSOLE, OBJECT)
+
 struct VCChardev {
     Chardev parent;
     QemuConsole *console;
@@ -1314,6 +1316,21 @@  static QemuConsole *new_console(console_type_t console_type,
     return s;
 }
 
+static void
+qemu_console_finalize(Object *obj)
+{
+}
+
+static void
+qemu_console_class_init(ObjectClass *oc, void *data)
+{
+}
+
+static void
+qemu_console_init(Object *obj)
+{
+}
+
 #ifdef WIN32
 void qemu_displaysurface_win32_set_handle(DisplaySurface *surface,
                                           HANDLE h, uint32_t offset)
@@ -2647,13 +2664,6 @@  void qemu_chr_parse_vc(QemuOpts *opts, ChardevBackend *backend, Error **errp)
     }
 }
 
-static const TypeInfo qemu_console_info = {
-    .name = TYPE_QEMU_CONSOLE,
-    .parent = TYPE_OBJECT,
-    .instance_size = sizeof(QemuConsole),
-    .class_size = sizeof(QemuConsoleClass),
-};
-
 static void char_vc_class_init(ObjectClass *oc, void *data)
 {
     ChardevClass *cc = CHARDEV_CLASS(oc);
@@ -2679,10 +2689,3 @@  void qemu_console_early_init(void)
         type_register(&char_vc_type_info);
     }
 }
-
-static void register_types(void)
-{
-    type_register_static(&qemu_console_info);
-}
-
-type_init(register_types);