[libvirt] [RFC PATCH 2/6] conf: Tweak HPT parsing and formatting

Andrea Bolognani abologna at redhat.com
Wed May 23 16:50:04 UTC 2018


On Wed, 2018-05-23 at 18:42 +0200, Peter Krempa wrote:
> On Wed, May 23, 2018 at 18:17:58 +0200, Andrea Bolognani wrote:
> > +                if (hasResizing) {
> > +                    if (virAsprintf(&resizing, " resizing='%s'",
> > +                                    virDomainHPTResizingTypeToStri
> > ng(def->hpt_resizing)) < 0) {
> > +                        goto error;
> > +                    }
> > +                } else {
> > +                    if (VIR_STRDUP(resizing, "") < 0)
> > +                        goto error;
> > +                }
> >  
> > -                virBufferAsprintf(buf, "<hpt resizing='%s'/>\n",
> > -                                  virDomainHPTResizingTypeToString
> > (def->hpt_resizing));
> > +                virBufferAsprintf(buf, "<hpt%s/>\n",
> 
> This formulation looks fishy.

I don't love it either, but I've tried a bunch of alternative
approaches and this seemed like the most sane to me.

If you have suggestions on how to improve it, considering that the
end result is what you see after patch 5/6, please do share! :)

-- 
Andrea Bolognani / Red Hat / Virtualization




More information about the libvir-list mailing list