I recently noticed that when cJSON parses a JSON true, it sets valueint to 1, which seems like a nice way to easly support number 0/1 and boolean false/true with a single test. However, I noticed that an object created by cJSON_CreateTrue does not set valueint to 1. Maybe cJSON_CreateTrue should, so that a True object created by either cJSON_Parse or cJSON_CreateTrue look the same?
If you were to set valueint to 1 in cJSON_CreateTrue, then maybe you should change cJSON_CreateBool to call cJSON_CreateTrue or cJSON_CreateFalse so that this kind of mod is more isolated to the basic cJSON_CreateTrue function. I.e.:
I recently noticed that when cJSON parses a JSON
true
, it setsvalueint
to1
, which seems like a nice way to easly support number 0/1 and boolean false/true with a single test. However, I noticed that an object created bycJSON_CreateTrue
does not setvalueint
to1
. MaybecJSON_CreateTrue
should, so that a True object created by eithercJSON_Parse
orcJSON_CreateTrue
look the same?If you were to set
valueint
to1
incJSON_CreateTrue
, then maybe you should changecJSON_CreateBool
to callcJSON_CreateTrue
orcJSON_CreateFalse
so that this kind of mod is more isolated to the basiccJSON_CreateTrue
function. I.e.:...snip...