diff --git a/3party/jansson/src/config.h b/3party/jansson/src/config.h index 7296155c8f..c1d6cd3533 100644 --- a/3party/jansson/src/config.h +++ b/3party/jansson/src/config.h @@ -5,7 +5,9 @@ #define HAVE_DLFCN_H 1 /* Define to 1 if you have the header file. */ +#ifndef _MSC_VER #define HAVE_INTTYPES_H 1 +#endif /* Define to 1 if you have the header file. */ #define HAVE_MEMORY_H 1 @@ -37,7 +39,13 @@ /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus -/* #undef inline */ + #ifdef _MSC_VER + #define JSON_INLINE + #else + #define JSON_INLINE inline + #endif +#else + #define JSON_INLINE inline #endif /* Define to the type of a signed integer type of width exactly 32 bits if diff --git a/3party/jansson/src/hashtable.c b/3party/jansson/src/hashtable.c index 066476eb30..44d2ccea4d 100644 --- a/3party/jansson/src/hashtable.c +++ b/3party/jansson/src/hashtable.c @@ -19,13 +19,13 @@ typedef struct hashtable_bucket bucket_t; #define list_to_pair(list_) container_of(list_, pair_t, list) -static inline void list_init(list_t *list) +static JSON_INLINE void list_init(list_t *list) { list->next = list; list->prev = list; } -static inline void list_insert(list_t *list, list_t *node) +static JSON_INLINE void list_insert(list_t *list, list_t *node) { node->next = list; node->prev = list->prev; @@ -33,13 +33,13 @@ static inline void list_insert(list_t *list, list_t *node) list->prev = node; } -static inline void list_remove(list_t *list) +static JSON_INLINE void list_remove(list_t *list) { list->prev->next = list->next; list->next->prev = list->prev; } -static inline int bucket_is_empty(hashtable_t *hashtable, bucket_t *bucket) +static JSON_INLINE int bucket_is_empty(hashtable_t *hashtable, bucket_t *bucket) { return bucket->first == &hashtable->list && bucket->first == bucket->last; } @@ -67,7 +67,7 @@ static unsigned int primes[] = { }; static const unsigned int num_primes = sizeof(primes) / sizeof(unsigned int); -static inline unsigned int num_buckets(hashtable_t *hashtable) +static JSON_INLINE unsigned int num_buckets(hashtable_t *hashtable) { return primes[hashtable->num_buckets]; } diff --git a/3party/jansson/src/jansson.h b/3party/jansson/src/jansson.h index 4c526fee16..2a6f8eeef1 100644 --- a/3party/jansson/src/jansson.h +++ b/3party/jansson/src/jansson.h @@ -8,12 +8,11 @@ #ifndef JANSSON_H #define JANSSON_H +#include "config.h" + #include -#ifndef __cplusplus -#define JSON_INLINE inline -#else -#define JSON_INLINE inline +#ifdef __cplusplus extern "C" { #endif @@ -106,7 +105,7 @@ int json_object_set_nocheck(json_t *object, const char *key, json_t *value) return json_object_set_new_nocheck(object, key, json_incref(value)); } -static inline +static JSON_INLINE int json_object_iter_set(json_t *object, void *iter, json_t *value) { return json_object_iter_set_new(object, iter, json_incref(value)); diff --git a/3party/jansson/src/load.c b/3party/jansson/src/load.c index 7cc00848c1..afb5fd2aed 100644 --- a/3party/jansson/src/load.c +++ b/3party/jansson/src/load.c @@ -810,8 +810,8 @@ json_t *json_loads(const char *string, json_error_t *error) json_t *result; string_data_t stream_data = { - .data = string, - .pos = 0 + string, + 0 }; if(lex_init(&lex, string_get, string_eof, (void *)&stream_data)) diff --git a/3party/jansson/src/utf.h b/3party/jansson/src/utf.h index 61491ae544..9ddcbc748f 100644 --- a/3party/jansson/src/utf.h +++ b/3party/jansson/src/utf.h @@ -11,10 +11,12 @@ #include "config.h" #ifdef HAVE_INTTYPES_H -/* inttypes.h includes stdint.h in a standard environment, so there's -no need to include stdint.h separately. If inttypes.h doesn't define -int32_t, it's defined in config.h. */ -#include + /* inttypes.h includes stdint.h in a standard environment, so there's + no need to include stdint.h separately. If inttypes.h doesn't define + int32_t, it's defined in config.h. */ + #include +#else + typedef __int32 int32_t; #endif int utf8_encode(int codepoint, char *buffer, int *size); diff --git a/3party/jansson/src/value.c b/3party/jansson/src/value.c index a9ef8a50fc..2d58f8cc86 100644 --- a/3party/jansson/src/value.c +++ b/3party/jansson/src/value.c @@ -19,7 +19,7 @@ #include "util.h" -static inline void json_init(json_t *json, json_type type) +static JSON_INLINE void json_init(json_t *json, json_type type) { json->type = type; json->refcount = 1; @@ -835,8 +835,8 @@ double json_number_value(const json_t *json) json_t *json_true(void) { static json_t the_true = { - .type = JSON_TRUE, - .refcount = (unsigned int)-1 + JSON_TRUE, + (unsigned int)-1 }; return &the_true; } @@ -845,8 +845,8 @@ json_t *json_true(void) json_t *json_false(void) { static json_t the_false = { - .type = JSON_FALSE, - .refcount = (unsigned int)-1 + JSON_FALSE, + (unsigned int)-1 }; return &the_false; } @@ -855,8 +855,8 @@ json_t *json_false(void) json_t *json_null(void) { static json_t the_null = { - .type = JSON_NULL, - .refcount = (unsigned int)-1 + JSON_NULL, + (unsigned int)-1 }; return &the_null; }