mirror of
https://github.com/json-c/json-c.git
synced 2026-04-08 06:49:07 +08:00
clang-format test1.c
This commit is contained in:
@@ -149,7 +149,7 @@ void test_array_list_expand_internal()
|
|||||||
|
|
||||||
my_array = make_array();
|
my_array = make_array();
|
||||||
printf("my_array=\n");
|
printf("my_array=\n");
|
||||||
for(ii = 0; ii < json_object_array_length(my_array); ii++)
|
for (ii = 0; ii < json_object_array_length(my_array); ii++)
|
||||||
{
|
{
|
||||||
json_object *obj = json_object_array_get_idx(my_array, ii);
|
json_object *obj = json_object_array_get_idx(my_array, ii);
|
||||||
printf("\t[%d]=%s\n", (int)ii, json_object_to_json_string(obj));
|
printf("\t[%d]=%s\n", (int)ii, json_object_to_json_string(obj));
|
||||||
@@ -172,7 +172,7 @@ void test_array_list_expand_internal()
|
|||||||
|
|
||||||
/* SIZE_T_MAX <= Put Index, it will fail and the size will no change. */
|
/* SIZE_T_MAX <= Put Index, it will fail and the size will no change. */
|
||||||
idx = SIZE_MAX; // SIZE_MAX = SIZE_T_MAX
|
idx = SIZE_MAX; // SIZE_MAX = SIZE_T_MAX
|
||||||
json_object* tmp = json_object_new_int(10);
|
json_object *tmp = json_object_new_int(10);
|
||||||
rc = json_object_array_put_idx(my_array, idx, tmp);
|
rc = json_object_array_put_idx(my_array, idx, tmp);
|
||||||
printf("put_idx(SIZE_T_MAX,0)=%d\n", rc);
|
printf("put_idx(SIZE_T_MAX,0)=%d\n", rc);
|
||||||
if (rc == -1)
|
if (rc == -1)
|
||||||
@@ -271,9 +271,10 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
printf("my_array.to_string()=%s\n", json_object_to_json_string(my_array));
|
printf("my_array.to_string()=%s\n", json_object_to_json_string(my_array));
|
||||||
|
|
||||||
json_object* one = json_object_new_int(1);
|
json_object *one = json_object_new_int(1);
|
||||||
json_object* result = json_object_array_bsearch(one, my_array, sort_fn);
|
json_object *result = json_object_array_bsearch(one, my_array, sort_fn);
|
||||||
printf("find json_object(1) in my_array successfully: %s\n", json_object_to_json_string(result));
|
printf("find json_object(1) in my_array successfully: %s\n",
|
||||||
|
json_object_to_json_string(result));
|
||||||
json_object_put(one);
|
json_object_put(one);
|
||||||
|
|
||||||
my_object = json_object_new_object();
|
my_object = json_object_new_object();
|
||||||
|
|||||||
Reference in New Issue
Block a user