diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2014-06-16 18:07:03 +0300 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2014-06-19 18:44:21 +0300 |
commit | 0d156683f667ef20fa20abc21e85ee776e6c1472 (patch) | |
tree | d74cc1878e458078331a949f961a980e133ba00b | |
parent | 69e255635d0126dcce60b17454a7ec23e7afc174 (diff) | |
download | qemu-0d156683f667ef20fa20abc21e85ee776e6c1472.zip qemu-0d156683f667ef20fa20abc21e85ee776e6c1472.tar.gz qemu-0d156683f667ef20fa20abc21e85ee776e6c1472.tar.bz2 |
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>
-rw-r--r-- | qapi/string-input-visitor.c | 13 | ||||
-rw-r--r-- | qapi/string-output-visitor.c | 8 |
2 files changed, 17 insertions, 4 deletions
diff --git a/qapi/string-input-visitor.c b/qapi/string-input-visitor.c index 0b2490b..72722e6 100644 --- a/qapi/string-input-visitor.c +++ b/qapi/string-input-visitor.c @@ -32,6 +32,11 @@ struct StringInputVisitor const char *string; }; +static void free_range(void *range, void *dummy) +{ + g_free(range); +} + static void parse_str(StringInputVisitor *siv, Error **errp) { char *str = (char *) siv->string; @@ -108,8 +113,9 @@ static void parse_str(StringInputVisitor *siv, Error **errp) return; error: - g_list_free_full(siv->ranges, g_free); - assert(siv->ranges == NULL); + g_list_foreach(siv->ranges, free_range, NULL); + g_list_free(siv->ranges); + siv->ranges = NULL; } static void @@ -314,7 +320,8 @@ Visitor *string_input_get_visitor(StringInputVisitor *v) void string_input_visitor_cleanup(StringInputVisitor *v) { - g_list_free_full(v->ranges, g_free); + g_list_foreach(v->ranges, free_range, NULL); + g_list_free(v->ranges); g_free(v); } 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 @@ Visitor *string_output_get_visitor(StringOutputVisitor *sov) 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); } |