[libvirt] [PATCH 02/23] util: buffer: Add API to set indentation level to a given value

Peter Krempa pkrempa at redhat.com
Thu Mar 23 07:14:42 UTC 2017


On Wed, Mar 22, 2017 at 14:27:18 -0500, Eric Blake wrote:
> On 03/15/2017 11:37 AM, Peter Krempa wrote:
> > It will be useful to set indentation level to 0 after formatting a
> > nested structure rather than having to track the depth.
> > ---
> >  src/libvirt_private.syms |  1 +
> >  src/util/virbuffer.c     | 19 +++++++++++++++++++
> >  src/util/virbuffer.h     |  2 ++
> >  3 files changed, 22 insertions(+)
> > 
> 
> > +
> > +/**
> > + * virBufferAdjustIndent:
> 
> Too much copy-and-paste.
> 
> > + * @buf: the buffer
> > + * @indent: new indentation size.
> > + *
> > + * Set the auto-indent value to @indent. See virBufferAdjustIndent on how auto
> > + * indentation is applied.
> > + */
> > +void
> > +virBufferSetIndent(virBufferPtr buf, int indent)
> > +{
> > +    if (!buf || buf->error)
> > +        return;
> > +
> > +    buf->indent = indent;
> > +}
> > +
> 
> No testsuite addition?

For such trivial operation? I think we have pretty strong coverage of
the indentation code. This simple setter isn't worth it IMO.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170323/8fc3964d/attachment-0001.sig>


More information about the libvir-list mailing list