diff options
author | Petri Lehtinen <petri@digip.org> | 2011-03-20 21:15:39 +0200 |
---|---|---|
committer | Petri Lehtinen <petri@digip.org> | 2011-03-20 21:23:37 +0200 |
commit | b90ed1accb3fcdf1111dbe33a2ce4519eb6e5d0c (patch) | |
tree | ae1d5ffd6464582383675193318c797d2590a98e /src/jansson_private.h | |
parent | 11119601205b4276464e55a6518049a370560e60 (diff) | |
download | jansson-b90ed1accb3fcdf1111dbe33a2ce4519eb6e5d0c.zip jansson-b90ed1accb3fcdf1111dbe33a2ce4519eb6e5d0c.tar.gz jansson-b90ed1accb3fcdf1111dbe33a2ce4519eb6e5d0c.tar.bz2 |
Enhance portability of va_copy()
va_copy() is a C99 feature. In C89 implementations, it's sometimes
available as __va_copy(). If not, memcpy() should do the trick.
Diffstat (limited to 'src/jansson_private.h')
-rw-r--r-- | src/jansson_private.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/jansson_private.h b/src/jansson_private.h index 08731e8..9224b31 100644 --- a/src/jansson_private.h +++ b/src/jansson_private.h @@ -9,7 +9,6 @@ #define JANSSON_PRIVATE_H #include <stddef.h> -#include <stdarg.h> #include "jansson.h" #include "hashtable.h" @@ -21,6 +20,16 @@ #define max(a, b) ((a) > (b) ? (a) : (b)) #endif +/* va_copy is a C99 feature. In C89 implementations, it's sometimes + available as __va_copy. If not, memcpy() should do the trick. */ +#ifndef va_copy +#ifdef __va_copy +#define va_copy __va_copy +#else +#define va_copy(a, b) memcpy(&(a), &(b), sizeof(va_list)) +#endif +#endif + typedef struct { json_t json; hashtable_t hashtable; |