qapi: fix build on glib < 2.28
The following commits:
qapi: make string output visitor parse int list
qapi: make string input visitor parse int list
break with glib < 2.28 since they use the
new g_list_free_full function.
Open-code that to fix build on old systems.
Cc: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
diff --git a/qapi/string-output-visitor.c b/qapi/string-output-visitor.c
index 1c0834a..8735b00 100644
--- a/qapi/string-output-visitor.c
+++ b/qapi/string-output-visitor.c
@@ -316,13 +316,19 @@
return &sov->visitor;
}
+static void free_range(void *range, void *dummy)
+{
+ g_free(range);
+}
+
void string_output_visitor_cleanup(StringOutputVisitor *sov)
{
if (sov->string) {
g_string_free(sov->string, true);
}
- g_list_free_full(sov->ranges, g_free);
+ g_list_foreach(sov->ranges, free_range, NULL);
+ g_list_free(sov->ranges);
g_free(sov);
}