[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 093/103] qapi: fix build on glib < 2.28
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 093/103] qapi: fix build on glib < 2.28 |
Date: |
Tue, 17 Jun 2014 20:42:03 +0300 |
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 <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
qapi/string-input-visitor.c | 13 ++++++++++---
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);
}
--
MST
- [Qemu-devel] [PULL 085/103] hostmem: allow preallocation of any memory region, (continued)
- [Qemu-devel] [PULL 085/103] hostmem: allow preallocation of any memory region, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 089/103] hmp: add info memdev, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 090/103] tests: fix memory leak in test of string input visitor, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 091/103] qapi: make string input visitor parse int list, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 092/103] qapi: make string output visitor parse int list, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 093/103] qapi: fix build on glib < 2.28,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 094/103] qdev: reorganize error reporting in bus_set_realized, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 095/103] qdev: recursively unrealize devices when unrealizing bus, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 096/103] qmp: clean out whitespace, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 048/103] Add G_IO_HUP handler for socket chardev, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 063/103] NUMA: check if the total numa memory size is equal to ram_size, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 064/103] NUMA: Add numa_info structure to contain numa nodes info, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 099/103] qmp: add query-memory-devices command, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 100/103] acpi: introduce TYPE_ACPI_DEVICE_IF interface, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 062/103] NUMA: move numa related code to new file numa.c, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 097/103] pc: acpi: do not hardcode preprocessor, Michael S. Tsirkin, 2014/06/17