diff options
author | Florian Frank <flori@ping.de> | 2010-08-08 20:28:11 +0200 |
---|---|---|
committer | Florian Frank <flori@ping.de> | 2010-08-18 03:42:53 +0200 |
commit | b510a1d2051e55bc99520d384baf4a392712f61f (patch) | |
tree | 8976a51a97bfd5a289330a3e9a0d699987386ff5 /ext/json | |
parent | 4223670e9cc38f46e08726162b14a2d0d8e94fd2 (diff) | |
download | json-b510a1d2051e55bc99520d384baf4a392712f61f.tar.gz |
keep track of depth correctly
Diffstat (limited to 'ext/json')
-rw-r--r-- | ext/json/ext/generator/generator.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/json/ext/generator/generator.c b/ext/json/ext/generator/generator.c index 0617466..ca82363 100644 --- a/ext/json/ext/generator/generator.c +++ b/ext/json/ext/generator/generator.c @@ -748,7 +748,7 @@ static void generate_json_object(FBuffer *buffer, VALUE Vstate, JSON_Generator_S VALUE key, key_to_s, keys; if (max_nesting != 0 && depth > max_nesting) { fbuffer_free(buffer); - rb_raise(eNestingError, "nesting of %ld is too deep", depth); + rb_raise(eNestingError, "nesting of %ld is too deep", --state->depth); } fbuffer_append_char(buffer, '{'); keys = rb_funcall(obj, i_keys, 0); @@ -794,7 +794,7 @@ static void generate_json_array(FBuffer *buffer, VALUE Vstate, JSON_Generator_St int i, j; if (max_nesting != 0 && depth > max_nesting) { fbuffer_free(buffer); - rb_raise(eNestingError, "nesting of %ld is too deep", depth); + rb_raise(eNestingError, "nesting of %ld is too deep", --state->depth); } fbuffer_append_char(buffer, '['); if (array_nl) fbuffer_append(buffer, array_nl, array_nl_len); |