]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virbuf: add auto-indentation support
authorEric Blake <eblake@redhat.com>
Thu, 20 Oct 2011 21:48:47 +0000 (15:48 -0600)
committerEric Blake <eblake@redhat.com>
Thu, 20 Oct 2011 22:02:16 +0000 (16:02 -0600)
commitfd9c052e6dcb5ae20d58f2f131a653ca4f5addbd
treea3f38b279bff3dfff80b2bd3b9cc597d3341b160
parent818a9665108368462aa46162e3182c167004323e
virbuf: add auto-indentation support

Rather than having to adjust all callers in a chain to deal with
indentation, it is nicer to have virBuffer do auto-indentation.

* src/util/buf.h (_virBuffer): Increase size.
(virBufferAdjustIndent, virBufferGetIndent): New prototypes.
* src/libvirt_private.syms (buf.h): Export new functions.
* src/util/buf.c (virBufferAdjustIndent, virBufferGetIndent): New
functions.
(virBufferSetError, virBufferAdd, virBufferAddChar)
(virBufferVasprintf, virBufferStrcat, virBufferURIEncodeString):
Implement auto-indentation.
* tests/virbuftest.c (testBufAutoIndent): Test it.
(testBufInfiniteLoop): Don't rely on internals.
Idea by Daniel P. Berrange.
src/libvirt_private.syms
src/util/buf.c
src/util/buf.h
tests/virbuftest.c