From 1d599e855be581716b3ac79775bfbc7e8ee74546 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Eidt?= Date: Wed, 26 Dec 2018 13:03:45 -0800 Subject: [PATCH 1/2] Update tiny-json.c Replaced keyword in struct jsonPool_s to fix error in Visual Studio --- tiny-json.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tiny-json.c b/tiny-json.c index 40ab8ab..b856690 100644 --- a/tiny-json.c +++ b/tiny-json.c @@ -61,7 +61,7 @@ char const* json_getPropertyValue( json_t const* obj, char const* property ) { static char* goBlank( char* str ); static char* goNum( char* str ); static json_t* poolInit( jsonPool_t* pool ); -static json_t* poolNew( jsonPool_t* pool ); +static json_t* poolAlloc( jsonPool_t* pool ); static char* objValue( char* ptr, json_t* obj, jsonPool_t* pool ); static char* setToNull( char* ch ); static bool isEndOfPrimitive( char ch ); @@ -86,7 +86,7 @@ json_t const* json_create( char* str, json_t mem[], unsigned int qty ) { .qty = qty, .pool = { .init = poolInit, - .new = poolNew + .alloc = poolAlloc } }; return json_createWithPool( str, &spool.pool ); @@ -348,7 +348,7 @@ static char* objValue( char* ptr, json_t* obj, jsonPool_t* pool ) { ++ptr; continue; } - json_t* property = pool->new( pool ); + json_t* property = pool->alloc( pool ); if ( !property ) return 0; if( obj->type != JSON_ARRAY ) { if ( *ptr != '\"' ) return 0; @@ -396,7 +396,7 @@ static json_t* poolInit( jsonPool_t* pool ) { * @param pool The handler of the pool. * @retval The handler of the new instance if success. * @retval Null pointer if the pool was empty. */ -static json_t* poolNew( jsonPool_t* pool ) { +static json_t* poolAlloc( jsonPool_t* pool ) { jsonStaticPool_t *spool = json_containerOf( pool, jsonStaticPool_t, pool ); if ( spool->nextFree >= spool->qty ) return 0; return spool->mem + spool->nextFree++; From f59ab0a05138190d83288c87df20ea2b4658d324 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Eidt?= Date: Wed, 26 Dec 2018 13:05:35 -0800 Subject: [PATCH 2/2] Update tiny-json.h Replaced keyword in struct jsonPool_s to fix error in Visual Studio --- tiny-json.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tiny-json.h b/tiny-json.h index 2984558..d592a4a 100644 --- a/tiny-json.h +++ b/tiny-json.h @@ -156,7 +156,7 @@ static inline double json_getReal( json_t const* property ) { typedef struct jsonPool_s jsonPool_t; struct jsonPool_s { json_t* (*init)( jsonPool_t* pool ); - json_t* (*new)( jsonPool_t* pool ); + json_t* (*alloc)( jsonPool_t* pool ); }; /** Parse a string to get a json.