summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorFlorian Frank <flori@ping.de>2010-08-03 03:47:48 +0200
committerFlorian Frank <flori@ping.de>2010-08-03 03:47:48 +0200
commit9f156be0fe40f57e4a5727904d5c2b761fa2cef2 (patch)
tree719aba3257f09dcf3c9ccddb71ea04e8199aa856 /ext
parentddc1eb3c70d4643e4e069a96b6a0752745dce9a2 (diff)
downloadjson-9f156be0fe40f57e4a5727904d5c2b761fa2cef2.tar.gz
use rb_funcall for duping
rbx doesn't support rb_obj_dup :-(
Diffstat (limited to 'ext')
-rw-r--r--ext/json/ext/generator/generator.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/ext/json/ext/generator/generator.c b/ext/json/ext/generator/generator.c
index 761274b..7658acd 100644
--- a/ext/json/ext/generator/generator.c
+++ b/ext/json/ext/generator/generator.c
@@ -14,7 +14,7 @@ static VALUE mJSON, mExt, mGenerator, cState, mGeneratorMethods, mObject,
static ID i_to_s, i_to_json, i_new, i_indent, i_space, i_space_before,
i_object_nl, i_array_nl, i_max_nesting, i_allow_nan, i_ascii_only,
i_pack, i_unpack, i_create_id, i_extend, i_key_p, i_aref, i_send,
- i_respond_to_p, i_match;
+ i_respond_to_p, i_match, i_keys, i_dup;
/*
* Copyright 2001-2004 Unicode, Inc.
@@ -1017,7 +1017,6 @@ static VALUE cState_initialize(int argc, VALUE *argv, VALUE self)
{
VALUE opts;
GET_STATE(self);
- MEMZERO(state, JSON_Generator_State, 1);
state->max_nesting = 19;
rb_scan_args(argc, argv, "01", &opts);
if (!NIL_P(opts)) cState_configure(self, opts);
@@ -1067,7 +1066,7 @@ static VALUE cState_from_state_s(VALUE self, VALUE opts)
if (NIL_P(CJSON_SAFE_STATE_PROTOTYPE)) {
CJSON_SAFE_STATE_PROTOTYPE = rb_const_get(mJSON, rb_intern("SAFE_STATE_PROTOTYPE"));
}
- return rb_obj_dup(CJSON_SAFE_STATE_PROTOTYPE);
+ return rb_funcall(CJSON_SAFE_STATE_PROTOTYPE, i_dup, 0);
}
}
@@ -1384,6 +1383,8 @@ void Init_generator()
i_send = rb_intern("__send__");
i_respond_to_p = rb_intern("respond_to?");
i_match = rb_intern("match");
+ i_keys = rb_intern("keys");
+ i_dup = rb_intern("dup");
#ifdef HAVE_RUBY_ENCODING_H
CEncoding_UTF_8 = rb_funcall(rb_path2class("Encoding"), rb_intern("find"), 1, rb_str_new2("utf-8"));
i_encoding = rb_intern("encoding");