|
@@ -37,4 +37,17 @@ int parse_qapi_name(const char *name, bool complete);
|
|
(list) = _tmp; \
|
|
(list) = _tmp; \
|
|
} while (0)
|
|
} while (0)
|
|
|
|
|
|
|
|
+/*
|
|
|
|
+ * For any pointer to a GenericList @tail (usually the 'next' member of a
|
|
|
|
+ * list element), insert @element at the back and update the tail.
|
|
|
|
+ *
|
|
|
|
+ * Note that this macro evaluates @element exactly once, so it is safe
|
|
|
|
+ * to have side-effects with that argument.
|
|
|
|
+ */
|
|
|
|
+#define QAPI_LIST_APPEND(tail, element) do { \
|
|
|
|
+ *(tail) = g_malloc0(sizeof(**(tail))); \
|
|
|
|
+ (*(tail))->value = (element); \
|
|
|
|
+ (tail) = &(*(tail))->next; \
|
|
|
|
+} while (0)
|
|
|
|
+
|
|
#endif
|
|
#endif
|