summaryrefslogtreecommitdiffstats
path: root/common/util.h
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2003-12-17 13:26:38 +0100
committerWerner Koch <wk@gnupg.org>2003-12-17 13:26:38 +0100
commit8ab35a7d26707dfa0032b3b0dbde6a984a9683cb (patch)
tree6506bd41badddfc72100a5f6c37a51c7f2099560 /common/util.h
parent(initialize): Replaced use of non-literal forma (diff)
downloadgnupg2-8ab35a7d26707dfa0032b3b0dbde6a984a9683cb.tar.xz
gnupg2-8ab35a7d26707dfa0032b3b0dbde6a984a9683cb.zip
* gettime.c (asctimestamp): Add a note on a non-avoidable gcc warning.
* util.h [!HAVE_VASPRINTF]: Add printf format attribute to the replacement function. * miscellaneous.c (xasprintf): New.
Diffstat (limited to 'common/util.h')
-rw-r--r--common/util.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/common/util.h b/common/util.h
index e38ced337..80a1d01a6 100644
--- a/common/util.h
+++ b/common/util.h
@@ -99,6 +99,12 @@ int answer_is_yes_no_quit (const char *s);
/*-- miscellaneous.c --*/
+
+/* 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, ...) JNLIB_GCC_A_PRINTF(1,2);
+
const char *print_fname_stdout (const char *s);
const char *print_fname_stdin (const char *s);
void print_string (FILE *fp, const byte *p, size_t n, int delim);
@@ -113,7 +119,7 @@ int is_file_compressed (const char *s, int *ret_rc);
#if !HAVE_VASPRINTF
#include <stdarg.h>
int vasprintf (char **result, const char *format, va_list args);
-int asprintf (char **result, const char *format, ...);
+int asprintf (char **result, const char *format, ...) JNLIB_GCC_A_PRINTF(2,3);
#endif