@@ -1184,7 +1184,7 @@ static VALUE convert_encoding(VALUE source)
1184
1184
return rb_funcall (source , i_encode , 1 , Encoding_UTF_8 );
1185
1185
}
1186
1186
1187
- static int configure_parser_i (VALUE key , VALUE val , VALUE data )
1187
+ static int parser_config_init_i (VALUE key , VALUE val , VALUE data )
1188
1188
{
1189
1189
JSON_ParserConfig * config = (JSON_ParserConfig * )data ;
1190
1190
@@ -1220,7 +1220,7 @@ static void parser_config_init(JSON_ParserConfig *config, VALUE opts)
1220
1220
if (RHASH_SIZE (opts ) > 0 ) {
1221
1221
// We assume in most cases few keys are set so it's faster to go over
1222
1222
// the provided keys than to check all possible keys.
1223
- rb_hash_foreach (opts , configure_parser_i , (VALUE )config );
1223
+ rb_hash_foreach (opts , parser_config_init_i , (VALUE )config );
1224
1224
1225
1225
if (config -> symbolize_names && config -> create_additions ) {
1226
1226
rb_raise (rb_eArgError ,
@@ -1273,6 +1273,13 @@ static VALUE cParserConfig_initialize(VALUE self, VALUE opts)
1273
1273
GET_PARSER_CONFIG ;
1274
1274
1275
1275
parser_config_init (config , opts );
1276
+
1277
+ RB_OBJ_WRITTEN (self , Qundef , config -> create_id );
1278
+ RB_OBJ_WRITTEN (self , Qundef , config -> object_class );
1279
+ RB_OBJ_WRITTEN (self , Qundef , config -> array_class );
1280
+ RB_OBJ_WRITTEN (self , Qundef , config -> decimal_class );
1281
+ RB_OBJ_WRITTEN (self , Qundef , config -> match_string );
1282
+
1276
1283
return self ;
1277
1284
}
1278
1285
@@ -1344,7 +1351,7 @@ static VALUE cParser_m_parse(VALUE klass, VALUE Vsource, VALUE opts)
1344
1351
return cParser_parse (config , Vsource );
1345
1352
}
1346
1353
1347
- static void JSON_mark (void * ptr )
1354
+ static void JSON_ParserConfig_mark (void * ptr )
1348
1355
{
1349
1356
JSON_ParserConfig * config = ptr ;
1350
1357
rb_gc_mark (config -> create_id );
@@ -1354,22 +1361,26 @@ static void JSON_mark(void *ptr)
1354
1361
rb_gc_mark (config -> match_string );
1355
1362
}
1356
1363
1357
- static void JSON_free (void * ptr )
1364
+ static void JSON_ParserConfig_free (void * ptr )
1358
1365
{
1359
1366
JSON_ParserConfig * config = ptr ;
1360
1367
ruby_xfree (config );
1361
1368
}
1362
1369
1363
- static size_t JSON_memsize (const void * ptr )
1370
+ static size_t JSON_ParserConfig_memsize (const void * ptr )
1364
1371
{
1365
1372
return sizeof (JSON_ParserConfig );
1366
1373
}
1367
1374
1368
1375
static const rb_data_type_t JSON_ParserConfig_type = {
1369
- "JSON/ParserConfig" ,
1370
- {JSON_mark , JSON_free , JSON_memsize ,},
1376
+ "JSON::Ext::Parser/ParserConfig" ,
1377
+ {
1378
+ JSON_ParserConfig_mark ,
1379
+ JSON_ParserConfig_free ,
1380
+ JSON_ParserConfig_memsize ,
1381
+ },
1371
1382
0 , 0 ,
1372
- RUBY_TYPED_FREE_IMMEDIATELY ,
1383
+ RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED ,
1373
1384
};
1374
1385
1375
1386
static VALUE cJSON_parser_s_allocate (VALUE klass )
0 commit comments