On Thu, May 12, 2016 at 07:49:30 -0400, John Ferlan wrote:
Soon we will need to escape a buffer string that cannot use strlen,
so
introduce this API to allow printing/escaping of the entire buffer.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/libvirt_private.syms | 1 +
src/util/virbuffer.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++
src/util/virbuffer.h | 3 +++
3 files changed, 58 insertions(+)
diff --git a/src/util/virbuffer.c b/src/util/virbuffer.c
index d582e7d..6985832 100644
--- a/src/util/virbuffer.c
+++ b/src/util/virbuffer.c
@@ -588,6 +588,60 @@ virBufferEscape(virBufferPtr buf, char escape, const char
*toescape,
VIR_FREE(escaped);
}
+
+/**
+ * virBufferEscapeSizedString:
I don't think this makes much sense. If the string contains nul '\0'
bytes this won't help at all since it will copy the \0 byte to the
resulting string.
If the string doesn't contain those, then the previously existing code
would work just fine.
If you want to put such stuff to a commandline you need to encode it to
base 64 anyways.