From 70984d47e9123a30cd1f564ffc04128844b21b80 Mon Sep 17 00:00:00 2001 From: Dave Gamble Date: Mon, 9 Feb 2015 17:28:26 +0000 Subject: [PATCH] patch to optimise array/object printing. git-svn-id: svn://svn.code.sf.net/p/cjson/code@60 e3330c51-1366-4df0-8b21-3ccf24e3d50e --- cJSON.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cJSON.c b/cJSON.c index 0ce5f08..3cb8254 100644 --- a/cJSON.c +++ b/cJSON.c @@ -383,6 +383,7 @@ static char *print_array(cJSON *item,int depth,int fmt) char *out=0,*ptr,*ret;int len=5; cJSON *child=item->child; int numentries=0,i=0,fail=0; + size_t tmplen=0; /* How many entries in the array? */ while (child) numentries++,child=child->next; @@ -425,7 +426,7 @@ static char *print_array(cJSON *item,int depth,int fmt) ptr=out+1;*ptr=0; for (i=0;ichild; int numentries=0,fail=0; + size_t tmplen=0; /* Count the number of entries. */ while (child) numentries++,child=child->next; /* Explicitly handle empty object case */ @@ -524,7 +526,7 @@ static char *print_object(cJSON *item,int depth,int fmt) for (i=0;i