提交 15dc7708 编写于 作者: P Peter Krempa

util: buffer: Add init macro for automatically setting child XML indent

Add a new macro which initializes a virBuffer on the stack and also sets
the indent level to be used for child XML element formatting.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 9a2ca9c9
...@@ -35,6 +35,15 @@ typedef virBuffer *virBufferPtr; ...@@ -35,6 +35,15 @@ typedef virBuffer *virBufferPtr;
#define VIR_BUFFER_INITIALIZER { NULL, 0 } #define VIR_BUFFER_INITIALIZER { NULL, 0 }
/**
* VIR_BUFFER_INIT_CHILD:
* @parentbuf: parent buffer for XML element formatting
*
* Intitialize a virBuffer structure and set up the indentation level for
* formatting XML subelements of @parentbuf.
*/
#define VIR_BUFFER_INIT_CHILD(parentbuf) { NULL, (parentbuf)->indent + 2 }
struct _virBuffer { struct _virBuffer {
GString *str; GString *str;
int indent; int indent;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册