All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] ui: use enum to string helpers
@ 2018-08-01  9:25 Marc-André Lureau
  2018-08-01 13:08 ` Markus Armbruster
  2018-08-21  5:40 ` Gerd Hoffmann
  0 siblings, 2 replies; 3+ messages in thread
From: Marc-André Lureau @ 2018-08-01  9:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: armbru, Marc-André Lureau, Gerd Hoffmann

Minor code simplification.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 qemu-keymap.c | 2 +-
 ui/console.c  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/qemu-keymap.c b/qemu-keymap.c
index 6216371aa1..4d00468747 100644
--- a/qemu-keymap.c
+++ b/qemu-keymap.c
@@ -84,7 +84,7 @@ static void walk_map(struct xkb_keymap *map, xkb_keycode_t code, void *data)
     }
     fprintf(outfile, "# evdev %d (0x%x), QKeyCode \"%s\", number 0x%x\n",
             evdev, evdev,
-            QKeyCode_lookup.array[qcode],
+            QKeyCode_str(qcode),
             qcode_to_number(qcode));
 
     /*
diff --git a/ui/console.c b/ui/console.c
index bc58458ee8..3a285bae00 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -2319,7 +2319,7 @@ bool qemu_display_find_default(DisplayOptions *opts)
 
     for (i = 0; i < ARRAY_SIZE(prio); i++) {
         if (dpys[prio[i]] == NULL) {
-            ui_module_load_one(DisplayType_lookup.array[prio[i]]);
+            ui_module_load_one(DisplayType_str(prio[i]));
         }
         if (dpys[prio[i]] == NULL) {
             continue;
@@ -2337,11 +2337,11 @@ void qemu_display_early_init(DisplayOptions *opts)
         return;
     }
     if (dpys[opts->type] == NULL) {
-        ui_module_load_one(DisplayType_lookup.array[opts->type]);
+        ui_module_load_one(DisplayType_str(opts->type));
     }
     if (dpys[opts->type] == NULL) {
         error_report("Display '%s' is not available.",
-                     DisplayType_lookup.array[opts->type]);
+                     DisplayType_str(opts->type));
         exit(1);
     }
     if (dpys[opts->type]->early_init) {
-- 
2.18.0.321.gffc6fa0e39

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] ui: use enum to string helpers
  2018-08-01  9:25 [Qemu-devel] [PATCH] ui: use enum to string helpers Marc-André Lureau
@ 2018-08-01 13:08 ` Markus Armbruster
  2018-08-21  5:40 ` Gerd Hoffmann
  1 sibling, 0 replies; 3+ messages in thread
From: Markus Armbruster @ 2018-08-01 13:08 UTC (permalink / raw)
  To: Marc-André Lureau; +Cc: qemu-devel, Gerd Hoffmann

Marc-André Lureau <marcandre.lureau@redhat.com> writes:

> Minor code simplification.

It's also a bit more robust: FOO_str(VAL) checks VAL is in range,
FOO_lookup.array[VAL] doesn't.

>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Reviewed-by: Markus Armbruster <armbru@redhat.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] ui: use enum to string helpers
  2018-08-01  9:25 [Qemu-devel] [PATCH] ui: use enum to string helpers Marc-André Lureau
  2018-08-01 13:08 ` Markus Armbruster
@ 2018-08-21  5:40 ` Gerd Hoffmann
  1 sibling, 0 replies; 3+ messages in thread
From: Gerd Hoffmann @ 2018-08-21  5:40 UTC (permalink / raw)
  To: Marc-André Lureau; +Cc: qemu-devel, armbru

On Wed, Aug 01, 2018 at 11:25:08AM +0200, Marc-André Lureau wrote:
> Minor code simplification.

Added to ui queue.

thanks,
  Gerd

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-08-21  5:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-01  9:25 [Qemu-devel] [PATCH] ui: use enum to string helpers Marc-André Lureau
2018-08-01 13:08 ` Markus Armbruster
2018-08-21  5:40 ` Gerd Hoffmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.