From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36530) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WxIc9-0004oR-NF for qemu-devel@nongnu.org; Wed, 18 Jun 2014 12:21:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WxIc4-0000o6-2i for qemu-devel@nongnu.org; Wed, 18 Jun 2014 12:21:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44286) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WxIc3-0000ns-QM for qemu-devel@nongnu.org; Wed, 18 Jun 2014 12:21:28 -0400 Date: Wed, 18 Jun 2014 19:21:47 +0300 From: "Michael S. Tsirkin" Message-ID: <1403108034-32054-93-git-send-email-mst@redhat.com> References: <1403108034-32054-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1403108034-32054-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL v2 092/106] qapi: fix build on glib < 2.28 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Luiz Capitulino , Michael Roth , Anthony Liguori , Hu Tao 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 Signed-off-by: Michael S. Tsirkin --- 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