1
0
Fork 0

DBG: updated jansson

This commit is contained in:
mrexodia 2016-10-13 22:46:52 +02:00
parent 1df99419c9
commit e7f9fae693
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
3 changed files with 33 additions and 5 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2014 Petri Lehtinen <petri@digip.org>
* Copyright (c) 2009-2016 Petri Lehtinen <petri@digip.org>
*
* Jansson is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
@ -21,11 +21,11 @@ extern "C" {
/* version */
#define JANSSON_MAJOR_VERSION 2
#define JANSSON_MINOR_VERSION 7
#define JANSSON_MINOR_VERSION 9
#define JANSSON_MICRO_VERSION 0
/* Micro version is omitted if it's 0 */
#define JANSSON_VERSION "2.7"
#define JANSSON_VERSION "2.9"
/* Version as a 3-byte hex number, e.g. 0x010201 == 1.2.1. Use this
for numeric comparisons, e.g. #if JANSSON_VERSION_HEX >= ... */
@ -114,6 +114,20 @@ void json_decref(json_t* json)
json_delete(json);
}
#if defined(__GNUC__) || defined(__clang__)
static JSON_INLINE
void json_decrefp(json_t** json)
{
if(json)
{
json_decref(*json);
*json = NULL;
}
}
#define json_auto_t json_t __attribute__((cleanup(json_decrefp)))
#endif
/* error reporting */
@ -155,6 +169,13 @@ __declspec(dllimport) int json_object_iter_set_new(json_t* object, void* iter, j
key && (value = json_object_iter_value(json_object_key_to_iter(key))); \
key = json_object_iter_key(json_object_iter_next(object, json_object_key_to_iter(key))))
#define json_object_foreach_safe(object, n, key, value) \
for(key = json_object_iter_key(json_object_iter(object)), \
n = json_object_iter_next(object, json_object_key_to_iter(key)); \
key && (value = json_object_iter_value(json_object_key_to_iter(key))); \
key = json_object_iter_key(n), \
n = json_object_iter_next(object, json_object_key_to_iter(key)))
#define json_array_foreach(array, index, value) \
for(index = 0; \
index < json_array_size(array) && (value = json_array_get(array, index)); \
@ -285,6 +306,7 @@ typedef void* (*json_malloc_t)(size_t);
typedef void (*json_free_t)(void*);
__declspec(dllimport) void json_set_alloc_funcs(json_malloc_t malloc_fn, json_free_t free_fn);
__declspec(dllimport) void json_get_alloc_funcs(json_malloc_t* malloc_fn, json_free_t* free_fn);
#ifdef __cplusplus
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2014 Petri Lehtinen <petri@digip.org>
* Copyright (c) 2010-2016 Petri Lehtinen <petri@digip.org>
*
* Jansson is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
@ -52,7 +52,7 @@
#define json_int_t long long
#define json_strtoint _strtoi64
#define json_strtoint strtoll
#define JSON_INTEGER_FORMAT "I64d"
@ -60,5 +60,9 @@
#define JSON_HAVE_LOCALECONV 1
/* Maximum recursion depth for parsing JSON input.
This limits the depth of e.g. array-within-array constructions. */
#define JSON_PARSER_MAX_DEPTH 2048
#endif

View File

@ -594,8 +594,10 @@ extern "C" DLL_EXPORT const char* _dbg_dbginit()
dbginit();
dputs(QT_TRANSLATE_NOOP("DBG", "Initializing debugger functions..."));
dbgfunctionsinit();
#ifdef ENABLE_MEM_TRACE
dputs(QT_TRANSLATE_NOOP("DBG", "Setting JSON memory management functions..."));
json_set_alloc_funcs(json_malloc, json_free);
#endif //ENABLE_MEM_TRACE
dputs(QT_TRANSLATE_NOOP("DBG", "Initializing capstone..."));
Capstone::GlobalInitialize();
dputs(QT_TRANSLATE_NOOP("DBG", "Initializing Yara..."));