1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

2004-01-30 Marcus Brinkmann <marcus@g10code.de>

* Makefile.am (libcommon_a_SOURCES): Add xasprintf.c.
	* miscellaneous.c (xasprintf): Moved to ...
	* xasprintf (xasprintf): ... here.  New file.
	This allows to use xasprintf without sucking in gpg-error.
This commit is contained in:
Marcus Brinkmann 2004-01-30 12:37:09 +00:00
parent 74a20c31e3
commit 0f7a19f3b0
4 changed files with 52 additions and 19 deletions

View file

@ -25,25 +25,6 @@
#include "util.h"
#include "iobuf.h"
/* 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. */
char *
xasprintf (const char *fmt, ...)
{
va_list ap;
char *buf, *p;
va_start (ap, fmt);
if (vasprintf (&buf, fmt, ap) < 0)
log_fatal ("asprintf failed: %s\n", strerror (errno));
va_end (ap);
p = xstrdup (buf);
free (buf);
return p;
}
/* Decide whether the filename is stdout or a real filename and return
* an appropriate string. */