[PATCH 1/7] util: buffer: Add init macro for automatically setting child XML indent

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

 



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: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/util/virbuffer.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/util/virbuffer.h b/src/util/virbuffer.h
index 8eb9608c71..a2e30c07dc 100644
--- a/src/util/virbuffer.h
+++ b/src/util/virbuffer.h
@@ -35,6 +35,15 @@ typedef virBuffer *virBufferPtr;

 #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 {
     GString *str;
     int indent;
-- 
2.23.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list





[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