summary refs log tree commit diff stats
path: root/qapi/qapi-util.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2017-08-24 10:46:07 +0200
committerMarkus Armbruster <armbru@redhat.com>2017-09-04 13:09:13 +0200
commit5b5f825d44306b18509cd10ba9ac6983e90d6e0f (patch)
tree4eaa8543ba0c568929b6879ff239b70ddfcef056 /qapi/qapi-util.c
parent1c236ba5319d6141964fddb38f1d942cebcaed05 (diff)
downloadfocaccia-qemu-5b5f825d44306b18509cd10ba9ac6983e90d6e0f.tar.gz
focaccia-qemu-5b5f825d44306b18509cd10ba9ac6983e90d6e0f.zip
qapi: Generate FOO_str() macro for QAPI enum FOO
The next commit will put it to use.  May look pointless now, but we're
going to change the FOO_lookup's type, and then it'll help.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1503564371-26090-13-git-send-email-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Diffstat (limited to 'qapi/qapi-util.c')
-rw-r--r--qapi/qapi-util.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/qapi/qapi-util.c b/qapi/qapi-util.c
index ee7594ff19..7af2f04d36 100644
--- a/qapi/qapi-util.c
+++ b/qapi/qapi-util.c
@@ -13,7 +13,13 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu-common.h"
-#include "qapi/util.h"
+
+const char *qapi_enum_lookup(const char *const lookup[], int val)
+{
+    assert(val >= 0);
+
+    return lookup[val];
+}
 
 int qapi_enum_parse(const char * const lookup[], const char *buf,
                     int def, Error **errp)