[PATCH v2 3/4] virsh: remove variable 'ret' and 'inactive'

Peter Krempa pkrempa at redhat.com
Fri Sep 24 08:08:18 UTC 2021


On Fri, Sep 24, 2021 at 10:02:07 +0200, Michal Prívozník wrote:
> On 9/24/21 1:49 AM, Kristina Hanicova wrote:
> > Signed-off-by: Kristina Hanicova <khanicov at redhat.com>
> > ---
> >  tools/virsh-interface.c | 15 ++++++---------
> >  tools/virsh-network.c   | 17 ++++++-----------
> >  2 files changed, 12 insertions(+), 20 deletions(-)
> > 
> > diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c
> > index 4bcc59b580..f402119b68 100644
> > --- a/tools/virsh-interface.c
> > +++ b/tools/virsh-interface.c
> > @@ -485,26 +485,23 @@ static bool
> >  cmdInterfaceDumpXML(vshControl *ctl, const vshCmd *cmd)
> >  {
> >      virInterfacePtr iface;
> 
> 1: this ^^^


> 
> >  
> > +    vshPrint(ctl, "%s", dump);
> >      virInterfaceFree(iface);
> > -    return ret;
> > +    return true;
> 
> I wonder whether we can declare an g_autoptr() cleanup for these public
> APIs. We can't do that in public headers BUT we could do it in something
> private, that's widely available (internal.h perhaps?). That way we
> could turn [1] into g_autoptr() and drop both these free calls.

See 'virshDomain' and the associated cleanup registration in
virsh-util.h

Also https://listman.redhat.com/archives/libvir-list/2021-September/msg00751.html

> Obviously, that's orthogonal to what you are doing here and as such must
> go into a standalone patchset. Just an idea I had.
> 
> Michal
> 




More information about the libvir-list mailing list