mirror of
https://github.com/json-c/json-c.git
synced 2026-03-29 18:09:07 +08:00
* Don't use this as a variable, so we can compile with a C++ compiler
* Add casts from void* to type of assignment when using malloc
* Add #ifdef __cplusplus guards to all of the headers
* Add typedefs for json_object, json_tokener, array_list, printbuf, lh_table
Michael Clark, <michael@metaparadigm.com>
git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@33 327403b1-1117-474d-bef2-5cb71233fd97
This commit is contained in:
8
test1.c
8
test1.c
@@ -7,9 +7,9 @@
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct json_tokener *tok;
|
||||
struct json_object *my_string, *my_int, *my_object, *my_array;
|
||||
struct json_object *new_obj;
|
||||
json_tokener *tok;
|
||||
json_object *my_string, *my_int, *my_object, *my_array;
|
||||
json_object *new_obj;
|
||||
int i;
|
||||
|
||||
MC_SET_DEBUG(1);
|
||||
@@ -39,7 +39,7 @@ int main(int argc, char **argv)
|
||||
json_object_array_put_idx(my_array, 4, json_object_new_int(5));
|
||||
printf("my_array=\n");
|
||||
for(i=0; i < json_object_array_length(my_array); i++) {
|
||||
struct json_object *obj = json_object_array_get_idx(my_array, i);
|
||||
json_object *obj = json_object_array_get_idx(my_array, i);
|
||||
printf("\t[%d]=%s\n", i, json_object_to_json_string(obj));
|
||||
}
|
||||
printf("my_array.to_string()=%s\n", json_object_to_json_string(my_array));
|
||||
|
||||
Reference in New Issue
Block a user