Re: [libvirt PATCH 3/4] domain_conf: refactor virDomainLoaderDefFormatNvram

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 07, 2025 at 01:37:49PM +0100, Ján Tomko wrote:
> On a Thursday in 2025, Pavel Hrdina wrote:
> > Use the new virXMLFormatDirect in order to remove usage of
> > virXMLFormatInternal.
> > 
> > Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
> > ---
> > src/conf/domain_conf.c | 18 ++++++++----------
> > 1 file changed, 8 insertions(+), 10 deletions(-)
> > 
> > diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> > index 94f456a362..0bcbf32bb4 100644
> > --- a/src/conf/domain_conf.c
> > +++ b/src/conf/domain_conf.c
> > @@ -27014,7 +27009,10 @@ virDomainLoaderDefFormatNvram(virBuffer *buf,
> >         }
> >     }
> > 
> > -    virXMLFormatElementInternal(buf, "nvram", &attrBuf, childBuf, false, childNewline);
> > +    if (virBufferUse(&directBuf) > 0)
> > +        virXMLFormatElementDirect(buf, "nvram", &attrBuf, &directBuf);
> > +    else
> > +        virXMLFormatElement(buf, "nvram", &attrBuf, &childBuf);
> > 
> 
> Not a fan of these extra lines.
>
> '<' is not a valid character in the element's "direct" value.
> Instead of the "childNewline" boolean, maybe virXMLFormatElement can check
> the first character for this and decide based on that?

It would remove few lines but hide the logic inside virXMLFormatElement
and make the code less readable IMHO. This makes it explicit what is
happening and I don't know if there is any other part of our XML that
would need this special case where the content can be both value or
subelement.

Pavel

> Jano
> 
> >     return 0;
> > }
> > -- 
> > 2.48.1
> > 


Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux