ui: use enum to string helpers
Minor code simplification.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-id: 20180801092508.4927-1-marcandre.lureau@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
diff --git a/qemu-keymap.c b/qemu-keymap.c
index 6216371..4d00468 100644
--- a/qemu-keymap.c
+++ b/qemu-keymap.c
@@ -84,7 +84,7 @@
}
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 bc58458..3a285ba 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -2319,7 +2319,7 @@
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 @@
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) {