[Pkg-libvirt-commits] [libguestfs] 29/36: daemon: add take_stringsbuf
Hilko Bengen
bengen at moszumanska.debian.org
Sun Nov 1 17:13:45 UTC 2015
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to annotated tag upstream/1.29.47
in repository libguestfs.
commit 23ac997d06e5d2a852d1ae0789d726778104def7
Author: Pino Toscano <ptoscano at redhat.com>
Date: Wed Jun 17 12:52:54 2015 +0200
daemon: add take_stringsbuf
---
daemon/daemon.h | 1 +
daemon/guestfsd.c | 12 ++++++++++++
2 files changed, 13 insertions(+)
diff --git a/daemon/daemon.h b/daemon/daemon.h
index d3ba148..f2244b0 100644
--- a/daemon/daemon.h
+++ b/daemon/daemon.h
@@ -92,6 +92,7 @@ extern int add_string (struct stringsbuf *sb, const char *str);
extern int add_sprintf (struct stringsbuf *sb, const char *fs, ...)
__attribute__((format (printf,2,3)));
extern int end_stringsbuf (struct stringsbuf *sb);
+extern char **take_stringsbuf (struct stringsbuf *sb);
extern void free_stringsbuf (struct stringsbuf *sb);
extern size_t count_strings (char *const *argv);
diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c
index a571aad..198b2b2 100644
--- a/daemon/guestfsd.c
+++ b/daemon/guestfsd.c
@@ -594,6 +594,18 @@ free_stringsbuf (struct stringsbuf *sb)
free_stringslen (sb->argv, sb->size);
}
+/* Take the ownership of the strings of the strings buffer,
+ * resetting it to a null buffer.
+ */
+char **
+take_stringsbuf (struct stringsbuf *sb)
+{
+ DECLARE_STRINGSBUF (null);
+ char **ret = sb->argv;
+ *sb = null;
+ return ret;
+}
+
size_t
count_strings (char *const *argv)
{
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git
More information about the Pkg-libvirt-commits
mailing list