summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorKenta Murata <mrkn@mrkn.jp>2020-12-20 12:17:32 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-12-22 13:57:23 +0900
commit483009dd8a6e9f2a19bce8f77a9541531f4a3eec (patch)
treec73b6cf1350daeed106990615b7d5f75558f8dec /ext
parent1bd46c49c064fb0f30fe679b887bb4034b6af9f5 (diff)
downloadjson-483009dd8a6e9f2a19bce8f77a9541531f4a3eec.tar.gz
[json] Stop using prototype objects
Diffstat (limited to 'ext')
-rw-r--r--ext/json/ext/generator/generator.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/ext/json/ext/generator/generator.c b/ext/json/ext/generator/generator.c
index 80d1ca7..2e802c8 100644
--- a/ext/json/ext/generator/generator.c
+++ b/ext/json/ext/generator/generator.c
@@ -15,8 +15,7 @@ static VALUE mJSON, mExt, mGenerator, cState, mGeneratorMethods, mObject,
#endif
mFloat, mString, mString_Extend,
mTrueClass, mFalseClass, mNilClass, eGeneratorError,
- eNestingError,
- i_SAFE_STATE_PROTOTYPE;
+ eNestingError;
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,
@@ -1166,8 +1165,7 @@ static VALUE cState_from_state_s(VALUE self, VALUE opts)
} else if (rb_obj_is_kind_of(opts, rb_cHash)) {
return rb_funcall(self, i_new, 1, opts);
} else {
- VALUE prototype = rb_const_get(mJSON, i_SAFE_STATE_PROTOTYPE);
- return rb_funcall(prototype, i_dup, 0);
+ return rb_class_new_instance(0, NULL, cState);
}
}
@@ -1608,5 +1606,4 @@ void Init_generator(void)
i_encoding = rb_intern("encoding");
i_encode = rb_intern("encode");
#endif
- i_SAFE_STATE_PROTOTYPE = rb_intern("SAFE_STATE_PROTOTYPE");
}