summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2009-04-23 18:52:06 +0100
committerRichard W.M. Jones <rjones@redhat.com>2009-04-23 18:52:06 +0100
commite2870fb94cbd22affecdd16e8f75f75e78d1c18b (patch)
tree173989306172b94820aa18c2e13bcb0a7aadbdfa
parent6eaa49faddeef5ec086ad7c58e0cd591fb4400dc (diff)
downloadlibguestfs-e2870fb94cbd22affecdd16e8f75f75e78d1c18b.tar.gz
libguestfs-e2870fb94cbd22affecdd16e8f75f75e78d1c18b.tar.xz
libguestfs-e2870fb94cbd22affecdd16e8f75f75e78d1c18b.zip
Implement extensible strings with catprintf.
-rw-r--r--daemon/daemon.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/daemon/daemon.h b/daemon/daemon.h
index 3f51056a..331fc0df 100644
--- a/daemon/daemon.h
+++ b/daemon/daemon.h
@@ -92,6 +92,14 @@ extern void send_file_end (int cancel);
/* only call this if there is a FileOut parameter */
extern void reply (xdrproc_t xdrp, char *ret);
+/* Append to existing string. If existing string is NULL then
+ * this creates a new string. This uses an "interesting" variation
+ * of asprintf.
+ */
+
+#define catprintf(strp,fs,...) \
+ asprintf ((strp), "%s" fs, *(strp) ? *(strp) : "", __VA_ARGS__)
+
/* Helper for functions that need a root filesystem mounted.
* NB. Cannot be used for FileIn functions.
*/