From 3d266528a977de931f58a2f8d309e968bbc7a211 Mon Sep 17 00:00:00 2001 From: stefan11111 Date: Mon, 30 Jun 2025 13:44:54 +0300 Subject: [PATCH] kdrive: ephyr: use c99 struct initialization For better readability and robustness against future changes, it's better to use named struct initializers instead of array-like lists. Signed-off-by: stefan11111 Signed-off-by: Enrico Weigelt, metux IT consult --- hw/kdrive/ephyr/ephyr.c | 26 ++++++++++++-------------- hw/kdrive/ephyr/ephyrinit.c | 26 +++++++++++--------------- 2 files changed, 23 insertions(+), 29 deletions(-) diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c index 9b00ed11f..cdc22cecf 100644 --- a/hw/kdrive/ephyr/ephyr.c +++ b/hw/kdrive/ephyr/ephyr.c @@ -1435,12 +1435,11 @@ MouseFini(KdPointerInfo * pi) } KdPointerDriver EphyrMouseDriver = { - "ephyr", - MouseInit, - MouseEnable, - MouseDisable, - MouseFini, - NULL, + .name = "ephyr", + .Init = MouseInit, + .Enable = MouseEnable, + .Disable = MouseDisable, + .Fini = MouseFini, }; /* Keyboard */ @@ -1509,12 +1508,11 @@ EphyrKeyboardBell(KdKeyboardInfo * ki, int volume, int frequency, int duration) } KdKeyboardDriver EphyrKeyboardDriver = { - "ephyr", - EphyrKeyboardInit, - EphyrKeyboardEnable, - EphyrKeyboardLeds, - EphyrKeyboardBell, - EphyrKeyboardDisable, - EphyrKeyboardFini, - NULL, + .name = "ephyr", + .Init = EphyrKeyboardInit, + .Enable = EphyrKeyboardEnable, + .Leds = EphyrKeyboardLeds, + .Bell = EphyrKeyboardBell, + .Disable = EphyrKeyboardDisable, + .Fini = EphyrKeyboardFini, }; diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c index ff0d5d0cc..fd5e73f82 100644 --- a/hw/kdrive/ephyr/ephyrinit.c +++ b/hw/kdrive/ephyr/ephyrinit.c @@ -390,23 +390,19 @@ OsVendorInit(void) } KdCardFuncs ephyrFuncs = { - ephyrCardInit, /* cardinit */ - ephyrScreenInitialize, /* scrinit */ - ephyrInitScreen, /* initScreen */ - ephyrFinishInitScreen, /* finishInitScreen */ - ephyrCreateResources, /* createRes */ - ephyrScreenFini, /* scrfini */ - ephyrCardFini, /* cardfini */ + .cardinit = ephyrCardInit, + .scrinit = ephyrScreenInitialize, + .initScreen = ephyrInitScreen, + .finishInitScreen = ephyrFinishInitScreen, + .createRes = ephyrCreateResources, - 0, /* initCursor */ + .scrfini = ephyrScreenFini, + .cardfini = ephyrCardFini, - 0, /* initAccel */ - 0, /* enableAccel */ - 0, /* disableAccel */ - 0, /* finiAccel */ + /* no cursor or accel funcs here */ - ephyrGetColors, /* getColors */ - ephyrPutColors, /* putColors */ + .getColors = ephyrGetColors, + .putColors = ephyrPutColors, - ephyrCloseScreen, /* closeScreen */ + .closeScreen = ephyrCloseScreen, };