summaryrefslogtreecommitdiff
path: root/src/estream-printf.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2014-08-23 09:51:41 +0200
committerWerner Koch <wk@gnupg.org>2014-08-25 16:37:46 +0200
commite5304d2c8aaaf1682707caa5694316640a18de57 (patch)
treee25da4049f43a3e28b2b7dc6421317298d417187 /src/estream-printf.c
parent216e7def2118a1774fa7ebeb45b8635b9fe6ba42 (diff)
downloadlibgpg-error-e5304d2c8aaaf1682707caa5694316640a18de57.tar.gz
Finish inclusion of estream into the API.
Diffstat (limited to 'src/estream-printf.c')
-rw-r--r--src/estream-printf.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/estream-printf.c b/src/estream-printf.c
index d2d13fc..b1eb828 100644
--- a/src/estream-printf.c
+++ b/src/estream-printf.c
@@ -1853,3 +1853,23 @@ _gpgrt_estream_asprintf (char **bufp, const char *format, ...)
return rc;
}
+
+/* A variant of asprintf. The function returns the allocated buffer
+ or NULL on error; ERRNO is set in the error case. The caller
+ should use es_free to release the buffer. This function actually
+ belongs into estream-printf but we put it here as a convenience
+ and because es_free is required anyway. */
+char *
+_gpgrt_estream_bsprintf (const char *format, ...)
+{
+ int rc;
+ va_list ap;
+ char *buf;
+
+ va_start (ap, format);
+ rc = _gpgrt_estream_vasprintf (&buf, format, ap);
+ va_end (ap);
+ if (rc < 0)
+ return NULL;
+ return buf;
+}