aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2018-12-12 16:30:28 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2019-01-07 16:18:41 +0400
commitfa386d989d0bec0abdcd1a883853071928adcced (patch)
tree290f8c77f3badb40b8b292b051246f6de47a82d5 /include
parentea9ce8934c5d2cc8925359a6d8d45eb829a9f27f (diff)
machines: replace COMPAT define with a static array
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Acked-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/hw/boards.h10
1 files changed, 3 insertions, 7 deletions
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 362384815e..a5d8ddd68b 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -289,18 +289,14 @@ struct MachineState {
} \
type_init(machine_initfn##_register_types)
-#define SET_MACHINE_COMPAT(m, COMPAT) \
+#define SET_MACHINE_COMPAT(m, compat) \
do { \
int i; \
- static GlobalProperty props[] = { \
- COMPAT \
- { /* end of list */ } \
- }; \
if (!m->compat_props) { \
m->compat_props = g_array_new(false, false, sizeof(void *)); \
} \
- for (i = 0; props[i].driver != NULL; i++) { \
- GlobalProperty *prop = &props[i]; \
+ for (i = 0; i < G_N_ELEMENTS(compat); i++) { \
+ GlobalProperty *prop = &compat[i]; \
g_array_append_val(m->compat_props, prop); \
} \
} while (0)