projects
/
jansson.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Zero the visited flag after encoding an empty array or object
[jansson.git]
/
src
/
dump.c
diff --git
a/src/dump.c
b/src/dump.c
index
ba70f8d
..
a36da03
100644
(file)
--- a/
src/dump.c
+++ b/
src/dump.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
+ * Copyright (c) 2009
, 2010
Petri Lehtinen <petri@digip.org>
*
* Jansson is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
*
* Jansson is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
@@
-9,7
+9,6
@@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <stdint.h>
#include <assert.h>
#include <jansson.h>
#include <assert.h>
#include <jansson.h>
@@
-232,8
+231,10
@@
static int do_dump(const json_t *json, unsigned long flags, int depth,
if(dump("[", 1, data))
return -1;
if(dump("[", 1, data))
return -1;
- if(n == 0)
+ if(n == 0) {
+ array->visited = 0;
return dump("]", 1, data);
return dump("]", 1, data);
+ }
if(dump_indent(flags, depth + 1, 0, dump, data))
return -1;
if(dump_indent(flags, depth + 1, 0, dump, data))
return -1;
@@
-285,8
+286,10
@@
static int do_dump(const json_t *json, unsigned long flags, int depth,
if(dump("{", 1, data))
return -1;
if(dump("{", 1, data))
return -1;
- if(!iter)
+ if(!iter) {
+ object->visited = 0;
return dump("}", 1, data);
return dump("}", 1, data);
+ }
if(dump_indent(flags, depth + 1, 0, dump, data))
return -1;
if(dump_indent(flags, depth + 1, 0, dump, data))
return -1;