mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
* 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.
This commit is contained in:
parent
911daed647
commit
8ab35a7d26
@ -1,3 +1,12 @@
|
||||
2003-12-17 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* 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.
|
||||
|
||||
2003-11-14 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* mkdtemp.c (mkdtemp): Use gcry_create_nonce.
|
||||
|
@ -246,9 +246,11 @@ asctimestamp( u32 stamp )
|
||||
mem2str( fmt, nl_langinfo(D_T_FMT), DIM(fmt)-3 );
|
||||
if( strstr( fmt, "%Z" ) == NULL )
|
||||
strcat( fmt, " %Z");
|
||||
strftime( buffer, DIM(buffer)-1, fmt, tp );
|
||||
/* NOTE: gcc -Wformat-noliteral will complain here. I have
|
||||
found no way to suppress this warning .*/
|
||||
strftime (buffer, DIM(buffer)-1, fmt, tp);
|
||||
#else
|
||||
/* fixme: we should check whether the locale appends a " %Z"
|
||||
/* FIXME: we should check whether the locale appends a " %Z"
|
||||
* These locales from glibc don't put the " %Z":
|
||||
* fi_FI hr_HR ja_JP lt_LT lv_LV POSIX ru_RU ru_SU sv_FI sv_SE zh_CN
|
||||
*/
|
||||
|
@ -25,6 +25,26 @@
|
||||
#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. */
|
||||
const char *
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user