summaryrefslogtreecommitdiff
path: root/ext/json/parser
diff options
context:
space:
mode:
authorJean Boussier <[email protected]>2024-11-03 09:27:59 +0100
committerJean Boussier <[email protected]>2024-11-05 18:00:36 +0100
commited22e6837941b429538cff5c8110b2caf2634474 ()
tree5c086bcd4f9f867e0579a8a7c76fc54202efec93 /ext/json/parser
parent241a03483c7eecfba008500df78716eb083d808b (diff)
[ruby/json] JSON::Ext::Parser mark the name cache entries when not on the heap
This is somewhat dead code as unless you are using `JSON::Parser.new` direcltly we never allocate `JSON::Ext::Parser` anymore. But still, we should mark all its reference in case some code out there uses that. Followup: #675 https://.com/ruby/json/commit/8bf74a977b
Notes: Merged: https://.com/ruby/ruby/pull/12003
-rw-r--r--ext/json/parser/extconf.rb5
-rw-r--r--ext/json/parser/parser.c15
-rw-r--r--ext/json/parser/parser.rl15
3 files changed, 32 insertions, 3 deletions
@@ -1,9 +1,8 @@
# frozen_string_literal: true
require 'mkmf'
-have_func("rb_enc_raise", "ruby.h")
-have_func("rb_enc_interned_str", "ruby.h")
-
append_cflags("-std=c99")
create_makefile 'json/ext/parser'
@@ -2115,6 +2115,19 @@ case 9:
}
}
static void JSON_mark(void *ptr)
{
JSON_Parser *json = ptr;
@@ -2124,6 +2137,8 @@ static void JSON_mark(void *ptr)
rb_gc_mark(json->array_class);
rb_gc_mark(json->decimal_class);
rb_gc_mark(json->match_string);
}
static void JSON_free(void *ptr)
@@ -875,6 +875,19 @@ static VALUE cParser_parse(VALUE self)
}
}
static void JSON_mark(void *ptr)
{
JSON_Parser *json = ptr;
@@ -884,6 +897,8 @@ static void JSON_mark(void *ptr)
rb_gc_mark(json->array_class);
rb_gc_mark(json->decimal_class);
rb_gc_mark(json->match_string);
}
static void JSON_free(void *ptr)