From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [PATCH] qapi: define cleanup function for g_autoptr(Error)
Date: Mon, 13 Sep 2021 09:25:26 +0100 [thread overview]
Message-ID: <YT8K5CIZ9NPz/730@redhat.com> (raw)
In-Reply-To: <7337ee08-cc7d-4ef1-dcc4-3b0facc8b7b1@redhat.com>
On Mon, Sep 13, 2021 at 09:30:07AM +0200, Paolo Bonzini wrote:
> On 13/09/21 07:23, Markus Armbruster wrote:
> > Paolo Bonzini <pbonzini@redhat.com> writes:
> >
> > > Allow replacing calls to error_free() with g_autoptr(Error)
> > > declarations.
> > >
> > > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> > > ---
> > > include/qapi/error.h | 2 ++
> > > 1 file changed, 2 insertions(+)
> > >
> > > diff --git a/include/qapi/error.h b/include/qapi/error.h
> > > index 4a9260b0cc..8564657baf 100644
> > > --- a/include/qapi/error.h
> > > +++ b/include/qapi/error.h
> > > @@ -437,6 +437,8 @@ Error *error_copy(const Error *err);
> > > */
> > > void error_free(Error *err);
> > > +G_DEFINE_AUTOPTR_CLEANUP_FUNC(Error, error_free);
> > > +
> > > /*
> > > * Convenience function to assert that *@errp is set, then silently free it.
> > > */
> >
> > I'd like to see at least one actual use.
>
> I'll have one soon, I'll Cc you on that one. (I wrote this because Dan
> suggested using g_autoptr(Error) in a review, but it doesn't work yet).
Actually on reflection we probably don't need that because I forgot
that error_report_err free's the error object.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2021-09-13 8:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-12 12:48 [PATCH] qapi: define cleanup function for g_autoptr(Error) Paolo Bonzini
2021-09-12 13:22 ` Richard Henderson
2021-09-13 5:23 ` Markus Armbruster
2021-09-13 7:30 ` Paolo Bonzini
2021-09-13 8:25 ` Daniel P. Berrangé [this message]
2021-09-13 9:31 ` Markus Armbruster
2021-09-13 13:08 ` Markus Armbruster
2021-09-13 15:09 ` Philippe Mathieu-Daudé
2021-09-14 4:46 ` Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YT8K5CIZ9NPz/730@redhat.com \
--to=berrange@redhat.com \
--cc=armbru@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).