|
@@ -1,4 +1,5 @@ |
|
|
#include <assert.h> |
|
|
#include <assert.h> |
|
|
|
|
|
#include <limits.h> |
|
|
#include <stddef.h> |
|
|
#include <stddef.h> |
|
|
#include <stdio.h> |
|
|
#include <stdio.h> |
|
|
#include <stdlib.h> |
|
|
#include <stdlib.h> |
|
@@ -307,6 +308,27 @@ int main(int argc, char **argv) |
|
|
} |
|
|
} |
|
|
printf("my_object.to_string()=%s\n", json_object_to_json_string(my_object)); |
|
|
printf("my_object.to_string()=%s\n", json_object_to_json_string(my_object)); |
|
|
|
|
|
|
|
|
|
|
|
json_object_put(my_array); |
|
|
|
|
|
my_array = json_object_new_array_ext(INT_MIN + 1); |
|
|
|
|
|
if (my_array != NULL) |
|
|
|
|
|
{ |
|
|
|
|
|
printf("ERROR: able to allocate an array of negative size!\n"); |
|
|
|
|
|
fflush(stdout); |
|
|
|
|
|
json_object_put(my_array); |
|
|
|
|
|
my_array = NULL; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#if SIZEOF_SIZE_T == SIZEOF_INT |
|
|
|
|
|
my_array = json_object_new_array_ext(INT_MAX / 2 + 2); |
|
|
|
|
|
if (my_array != NULL) |
|
|
|
|
|
{ |
|
|
|
|
|
printf("ERROR: able to allocate an array of insufficient size!\n"); |
|
|
|
|
|
fflush(stdout); |
|
|
|
|
|
json_object_put(my_array); |
|
|
|
|
|
my_array = NULL; |
|
|
|
|
|
} |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
json_object_put(my_string); |
|
|
json_object_put(my_string); |
|
|
json_object_put(my_int); |
|
|
json_object_put(my_int); |
|
|
json_object_put(my_null); |
|
|
json_object_put(my_null); |
|
|