• E
    virbuf: add auto-indentation support · fd9c052e
    Eric Blake 提交于
    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.
    fd9c052e
virbuftest.c 4.5 KB