iter = json_object_iter((json_t *)json);
if(dump("{", 1, data))
- return -1;
- if(!iter)
+ goto object_error;
+ if(!iter) {
+ object->visited = 0;
return dump("}", 1, data);
+ }
if(dump_indent(flags, depth + 1, 0, dump, data))
- return -1;
+ goto object_error;
- if(flags & JSON_SORT_KEYS)
+ if(flags & JSON_SORT_KEYS || flags & JSON_PRESERVE_ORDER)
{
- /* Sort keys */
-
- const char **keys;
+ const object_key_t **keys;
unsigned int size;
unsigned int i;
+ int (*cmp_func)(const void *, const void *);
size = json_object_size(json);
- keys = malloc(size * sizeof(const char *));
+ keys = malloc(size * sizeof(object_key_t *));
if(!keys)
- return -1;
+ goto object_error;
i = 0;
while(iter)