Skip to content

Commit a4a4e7c

Browse files
committed
make these PROPERLY ansi-c compliant ;)
git-svn-id: http://svn.code.sf.net/p/cjson/code@2 e3330c51-1366-4df0-8b21-3ccf24e3d50e
1 parent 805b652 commit a4a4e7c

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎cJSON.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ cJSON *cJSON_CreateArray() {cJSON *item=cJSON_New_Item();item->type=cJSON_A
354354
cJSON *cJSON_CreateObject() {cJSON *item=cJSON_New_Item();item->type=cJSON_Object;return item;}
355355

356356
// Create Arrays:
357-
cJSON *cJSON_CreateIntArray(int *numbers,int count) {cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(int i=0;i<count;i++){n=cJSON_CreateNumber(numbers[i]);if(!i)a->child=n;else suffix_object(p,n);p=n;}return a;}
358-
cJSON *cJSON_CreateFloatArray(float *numbers,int count) {cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(int i=0;i<count;i++){n=cJSON_CreateNumber(numbers[i]);if(!i)a->child=n;else suffix_object(p,n);p=n;}return a;}
359-
cJSON *cJSON_CreateDoubleArray(double *numbers,int count) {cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(int i=0;i<count;i++){n=cJSON_CreateNumber(numbers[i]);if(!i)a->child=n;else suffix_object(p,n);p=n;}return a;}
360-
cJSON *cJSON_CreateStringArray(const char **strings,int count) {cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(int i=0;i<count;i++){n=cJSON_CreateString(strings[i]);if(!i)a->child=n;else suffix_object(p,n);p=n;}return a;}
357+
cJSON *cJSON_CreateIntArray(int *numbers,int count) {int i;cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(i=0;i<count;i++){n=cJSON_CreateNumber(numbers[i]);if(!i)a->child=n;else suffix_object(p,n);p=n;}return a;}
358+
cJSON *cJSON_CreateFloatArray(float *numbers,int count) {int i;cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(i=0;i<count;i++){n=cJSON_CreateNumber(numbers[i]);if(!i)a->child=n;else suffix_object(p,n);p=n;}return a;}
359+
cJSON *cJSON_CreateDoubleArray(double *numbers,int count) {int i;cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(i=0;i<count;i++){n=cJSON_CreateNumber(numbers[i]);if(!i)a->child=n;else suffix_object(p,n);p=n;}return a;}
360+
cJSON *cJSON_CreateStringArray(const char **strings,int count) {int i;cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(i=0;i<count;i++){n=cJSON_CreateString(strings[i]);if(!i)a->child=n;else suffix_object(p,n);p=n;}return a;}

‎test.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ void create_objects()
102102
{"zip",37.371991,-1.22026e+2,"","SUNNYVALE","CA","94085","US"}};
103103

104104
root=cJSON_CreateArray();
105-
for (int i=0;i<2;i++)
105+
for (i=0;i<2;i++)
106106
{
107107
cJSON_AddItemToArray(root,fld=cJSON_CreateObject());
108108
cJSON_AddItemToObject(fld, "precision", cJSON_CreateString(fields[i].precision));

0 commit comments

Comments
 (0)