diff options
author | Werner Koch <wk@gnupg.org> | 2014-08-23 09:51:41 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2014-08-25 16:37:46 +0200 |
commit | e5304d2c8aaaf1682707caa5694316640a18de57 (patch) | |
tree | e25da4049f43a3e28b2b7dc6421317298d417187 /src/estream-printf.c | |
parent | 216e7def2118a1774fa7ebeb45b8635b9fe6ba42 (diff) | |
download | libgpg-error-e5304d2c8aaaf1682707caa5694316640a18de57.tar.gz |
Finish inclusion of estream into the API.
Diffstat (limited to 'src/estream-printf.c')
-rw-r--r-- | src/estream-printf.c | 20 |
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; +} |