Marc-André Lureau <marcandre.lur...@redhat.com> writes: > Use g_queue_free_full() directly. > > Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com> > --- > qobject/json-parser.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/qobject/json-parser.c b/qobject/json-parser.c > index 6baf73b4b9..0c0b478149 100644 > --- a/qobject/json-parser.c > +++ b/qobject/json-parser.c > @@ -561,11 +561,8 @@ QObject *json_parser_parse(GQueue *tokens, va_list *ap, > Error **errp) > > error_propagate(errp, ctxt.err); > > - while (!g_queue_is_empty(ctxt.buf)) { > - parser_context_pop_token(&ctxt); > - } > + g_queue_free_full(ctxt.buf, g_free); > g_free(ctxt.current); > - g_queue_free(ctxt.buf); > > return result; > }
Enabled by our recent upgrade to GLib 2.40 (commit e7b3af81). Dots into JSONParserContext, but it did so before the patch already. Perhaps turning JSONParserContext into a proper abstract data type would be slightly cleaner, but it doesn't seem worth the effort. Reviewed-by: Markus Armbruster <arm...@redhat.com>