summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2019-05-13 14:27:54 -0700
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2019-10-31 13:44:19 +0900
commit8ac832ad1c790f2119449af1754f6a80c4d917e7 (patch)
tree85909e422a26a1141431c9a95cd3932d5cf933ca
parentb2f06973cddf37cf86c68c82391976358dc05e46 (diff)
downloadjson-8ac832ad1c790f2119449af1754f6a80c4d917e7.tar.gz
Add NaN / Infinity / MinusInfinity to mark list
This prevents the constants from moving.
-rw-r--r--ext/json/ext/parser/parser.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/json/ext/parser/parser.c b/ext/json/ext/parser/parser.c
index 1fae9ca..0f98cf9 100644
--- a/ext/json/ext/parser/parser.c
+++ b/ext/json/ext/parser/parser.c
@@ -2097,8 +2097,13 @@ void Init_parser(void)
rb_define_method(cParser, "source", cParser_source, 0);
CNaN = rb_const_get(mJSON, rb_intern("NaN"));
+ rb_gc_register_mark_object(CNaN);
+
CInfinity = rb_const_get(mJSON, rb_intern("Infinity"));
+ rb_gc_register_mark_object(CInfinity);
+
CMinusInfinity = rb_const_get(mJSON, rb_intern("MinusInfinity"));
+ rb_gc_register_mark_object(CMinusInfinity);
i_json_creatable_p = rb_intern("json_creatable?");
i_json_create = rb_intern("json_create");