Fix for va_copy.

pull/13171/head
Josh Haberman 10 years ago
parent 19a973a85e
commit d9485c28ed
  1. 6
      upb/pb/textprinter.c
  2. 4
      upb/upb.h

@ -96,10 +96,6 @@ static int putescaped(upb_textprinter *p, const char *buf, size_t len,
return 0;
}
#ifdef __GNUC__
#define va_copy(a, b) __va_copy(a, b)
#endif
bool putf(upb_textprinter *p, const char *fmt, ...) {
va_list args;
va_list args_copy;
@ -111,7 +107,7 @@ bool putf(upb_textprinter *p, const char *fmt, ...) {
va_start(args, fmt);
/* Run once to get the length of the string. */
va_copy(args_copy, args);
_upb_va_copy(args_copy, args);
len = _upb_vsnprintf(NULL, 0, fmt, args_copy);
va_end(args_copy);

@ -52,12 +52,14 @@
#ifdef __GNUC__
#define _upb_snprintf __builtin_snprintf
#define _upb_vsnprintf __builtin_vsnprintf
#define _upb_va_copy(a, b) __va_copy(a, b)
#elif __STDC_VERSION__ >= 199901L
/* C99 versions. */
#define _upb_snprintf snprintf
#define _upb_vsnprintf vsnprintf
#define _upb_va_copy(a, b) va_copy(a, b)
#else
#error Need implementations of [v]snprintf
#error Need implementations of [v]snprintf and va_copy
#endif

Loading…
Cancel
Save