[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] qapi: define cleanup function for g_autoptr(Error)
From: |
Daniel P . Berrangé |
Subject: |
Re: [PATCH] qapi: define cleanup function for g_autoptr(Error) |
Date: |
Mon, 13 Sep 2021 09:25:26 +0100 |
User-agent: |
Mutt/2.0.7 (2021-05-04) |
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 :|