aboutsummaryrefslogtreecommitdiffstats
path: root/common/xasprintf.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2014-08-26 15:47:22 +0000
committerWerner Koch <[email protected]>2014-08-26 15:47:54 +0000
commit519305feb888b529c005b40445d041a088a2f8fc (patch)
tree74994a5b568e059982ca83a0daa8b7d96035355d /common/xasprintf.c
parentgpg: Allow for positional parameters in the passphrase prompt. (diff)
downloadgnupg-519305feb888b529c005b40445d041a088a2f8fc.tar.gz
gnupg-519305feb888b529c005b40445d041a088a2f8fc.zip
Switch to the libgpg-error provided estream.
* configure.ac (NEED_GPG_ERROR_VERSION): Reguire 1.14. (GPGRT_ENABLE_ES_MACROS): Define. (estream_INIT): Remove. * m4/estream.m4: Remove. * common/estream-printf.c, common/estream-printf.h: Remove. * common/estream.c, common/estream.h: Remove. * common/init.c (_init_common_subsystems): Call gpgrt initialization.
Diffstat (limited to 'common/xasprintf.c')
-rw-r--r--common/xasprintf.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/common/xasprintf.c b/common/xasprintf.c
index b1fb9c692..8adf2e471 100644
--- a/common/xasprintf.c
+++ b/common/xasprintf.c
@@ -32,15 +32,14 @@
#include <errno.h>
#include "util.h"
-#include "iobuf.h"
-
-#if !defined(_ESTREAM_PRINTF_REALLOC)
-#error Need to define _ESTREAM_PRINTF_REALLOC
-#endif
/* Same as asprintf but return an allocated buffer suitable to be
freed using xfree. This function simply dies on memory failure,
- thus no extra check is required. */
+ thus no extra check is required.
+
+ FIXME: We should remove these functions in favor of gpgrt_bsprintf
+ and a xgpgrt_bsprintf or rename them to xbsprintf and
+ xtrybsprintf. */
char *
xasprintf (const char *fmt, ...)
{
@@ -48,7 +47,7 @@ xasprintf (const char *fmt, ...)
char *buf;
va_start (ap, fmt);
- if (estream_vasprintf (&buf, fmt, ap) < 0)
+ if (gpgrt_vasprintf (&buf, fmt, ap) < 0)
log_fatal ("estream_asprintf failed: %s\n", strerror (errno));
va_end (ap);
return buf;
@@ -63,7 +62,7 @@ xtryasprintf (const char *fmt, ...)
char *buf;
va_start (ap, fmt);
- rc = estream_vasprintf (&buf, fmt, ap);
+ rc = gpgrt_vasprintf (&buf, fmt, ap);
va_end (ap);
if (rc < 0)
return NULL;