json 2.8.2 → 2.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -28,19 +28,6 @@ static const char deprecated_create_additions_warning[] =
28
28
  "and will be removed in 3.0, use JSON.unsafe_load or explicitly "
29
29
  "pass `create_additions: true`";
30
30
 
31
- #ifndef HAVE_RB_GC_MARK_LOCATIONS
32
- // For TruffleRuby
33
- void rb_gc_mark_locations(const VALUE *start, const VALUE *end)
34
- {
35
- VALUE *value = start;
36
-
37
- while (value < end) {
38
- rb_gc_mark(*value);
39
- value++;
40
- }
41
- }
42
- #endif
43
-
44
31
  #ifndef HAVE_RB_HASH_BULK_INSERT
45
32
  // For TruffleRuby
46
33
  void rb_hash_bulk_insert(long count, const VALUE *pairs, VALUE hash)
@@ -266,7 +253,10 @@ static inline void rvalue_stack_pop(rvalue_stack *stack, long count)
266
253
  static void rvalue_stack_mark(void *ptr)
267
254
  {
268
255
  rvalue_stack *stack = (rvalue_stack *)ptr;
269
- rb_gc_mark_locations(stack->ptr, stack->ptr + stack->head);
256
+ long index;
257
+ for (index = 0; index < stack->head; index++) {
258
+ rb_gc_mark(stack->ptr[index]);
259
+ }
270
260
  }
271
261
 
272
262
  static void rvalue_stack_free(void *ptr)
@@ -449,11 +439,11 @@ static void raise_parse_error(const char *format, const char *start)
449
439
 
450
440
 
451
441
 
452
- #line 475 "parser.rl"
442
+ #line 465 "parser.rl"
453
443
 
454
444
 
455
445
 
456
- #line 457 "parser.c"
446
+ #line 447 "parser.c"
457
447
  enum {JSON_object_start = 1};
458
448
  enum {JSON_object_first_final = 32};
459
449
  enum {JSON_object_error = 0};
@@ -461,7 +451,7 @@ enum {JSON_object_error = 0};
461
451
  enum {JSON_object_en_main = 1};
462
452
 
463
453
 
464
- #line 515 "parser.rl"
454
+ #line 505 "parser.rl"
465
455
 
466
456
 
467
457
  #define PUSH(result) rvalue_stack_push(json->stack, result, &json->stack_handle, &json->stack)
@@ -477,14 +467,14 @@ static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *resu
477
467
  long stack_head = json->stack->head;
478
468
 
479
469
 
480
- #line 481 "parser.c"
470
+ #line 471 "parser.c"
481
471
  {
482
472
  cs = JSON_object_start;
483
473
  }
484
474
 
485
- #line 530 "parser.rl"
475
+ #line 520 "parser.rl"
486
476
 
487
- #line 488 "parser.c"
477
+ #line 478 "parser.c"
488
478
  {
489
479
  short _widec;
490
480
  if ( p == pe )
@@ -513,7 +503,7 @@ case 2:
513
503
  goto st2;
514
504
  goto st0;
515
505
  tr2:
516
- #line 494 "parser.rl"
506
+ #line 484 "parser.rl"
517
507
  {
518
508
  char *np;
519
509
  json->parsing_name = true;
@@ -529,7 +519,7 @@ st3:
529
519
  if ( ++p == pe )
530
520
  goto _test_eof3;
531
521
  case 3:
532
- #line 533 "parser.c"
522
+ #line 523 "parser.c"
533
523
  switch( (*p) ) {
534
524
  case 13: goto st3;
535
525
  case 32: goto st3;
@@ -596,7 +586,7 @@ case 8:
596
586
  goto st8;
597
587
  goto st0;
598
588
  tr11:
599
- #line 483 "parser.rl"
589
+ #line 473 "parser.rl"
600
590
  {
601
591
  char *np = JSON_parse_value(json, p, pe, result, current_nesting);
602
592
  if (np == NULL) {
@@ -610,20 +600,20 @@ st9:
610
600
  if ( ++p == pe )
611
601
  goto _test_eof9;
612
602
  case 9:
613
- #line 614 "parser.c"
603
+ #line 604 "parser.c"
614
604
  _widec = (*p);
615
605
  if ( (*p) < 13 ) {
616
606
  if ( (*p) > 9 ) {
617
607
  if ( 10 <= (*p) && (*p) <= 10 ) {
618
608
  _widec = (short)(128 + ((*p) - -128));
619
609
  if (
620
- #line 492 "parser.rl"
610
+ #line 482 "parser.rl"
621
611
  json->allow_trailing_comma ) _widec += 256;
622
612
  }
623
613
  } else if ( (*p) >= 9 ) {
624
614
  _widec = (short)(128 + ((*p) - -128));
625
615
  if (
626
- #line 492 "parser.rl"
616
+ #line 482 "parser.rl"
627
617
  json->allow_trailing_comma ) _widec += 256;
628
618
  }
629
619
  } else if ( (*p) > 13 ) {
@@ -631,26 +621,26 @@ case 9:
631
621
  if ( 32 <= (*p) && (*p) <= 32 ) {
632
622
  _widec = (short)(128 + ((*p) - -128));
633
623
  if (
634
- #line 492 "parser.rl"
624
+ #line 482 "parser.rl"
635
625
  json->allow_trailing_comma ) _widec += 256;
636
626
  }
637
627
  } else if ( (*p) > 44 ) {
638
628
  if ( 47 <= (*p) && (*p) <= 47 ) {
639
629
  _widec = (short)(128 + ((*p) - -128));
640
630
  if (
641
- #line 492 "parser.rl"
631
+ #line 482 "parser.rl"
642
632
  json->allow_trailing_comma ) _widec += 256;
643
633
  }
644
634
  } else {
645
635
  _widec = (short)(128 + ((*p) - -128));
646
636
  if (
647
- #line 492 "parser.rl"
637
+ #line 482 "parser.rl"
648
638
  json->allow_trailing_comma ) _widec += 256;
649
639
  }
650
640
  } else {
651
641
  _widec = (short)(128 + ((*p) - -128));
652
642
  if (
653
- #line 492 "parser.rl"
643
+ #line 482 "parser.rl"
654
644
  json->allow_trailing_comma ) _widec += 256;
655
645
  }
656
646
  switch( _widec ) {
@@ -671,14 +661,14 @@ case 9:
671
661
  goto st10;
672
662
  goto st0;
673
663
  tr4:
674
- #line 505 "parser.rl"
664
+ #line 495 "parser.rl"
675
665
  { p--; {p++; cs = 32; goto _out;} }
676
666
  goto st32;
677
667
  st32:
678
668
  if ( ++p == pe )
679
669
  goto _test_eof32;
680
670
  case 32:
681
- #line 682 "parser.c"
671
+ #line 672 "parser.c"
682
672
  goto st0;
683
673
  st10:
684
674
  if ( ++p == pe )
@@ -780,13 +770,13 @@ case 20:
780
770
  if ( 47 <= (*p) && (*p) <= 47 ) {
781
771
  _widec = (short)(128 + ((*p) - -128));
782
772
  if (
783
- #line 492 "parser.rl"
773
+ #line 482 "parser.rl"
784
774
  json->allow_trailing_comma ) _widec += 256;
785
775
  }
786
776
  } else if ( (*p) >= 42 ) {
787
777
  _widec = (short)(128 + ((*p) - -128));
788
778
  if (
789
- #line 492 "parser.rl"
779
+ #line 482 "parser.rl"
790
780
  json->allow_trailing_comma ) _widec += 256;
791
781
  }
792
782
  switch( _widec ) {
@@ -805,20 +795,20 @@ case 21:
805
795
  if ( (*p) <= 41 ) {
806
796
  _widec = (short)(128 + ((*p) - -128));
807
797
  if (
808
- #line 492 "parser.rl"
798
+ #line 482 "parser.rl"
809
799
  json->allow_trailing_comma ) _widec += 256;
810
800
  }
811
801
  } else if ( (*p) > 42 ) {
812
802
  if ( 43 <= (*p) )
813
803
  { _widec = (short)(128 + ((*p) - -128));
814
804
  if (
815
- #line 492 "parser.rl"
805
+ #line 482 "parser.rl"
816
806
  json->allow_trailing_comma ) _widec += 256;
817
807
  }
818
808
  } else {
819
809
  _widec = (short)(128 + ((*p) - -128));
820
810
  if (
821
- #line 492 "parser.rl"
811
+ #line 482 "parser.rl"
822
812
  json->allow_trailing_comma ) _widec += 256;
823
813
  }
824
814
  switch( _widec ) {
@@ -841,13 +831,13 @@ case 22:
841
831
  if ( 42 <= (*p) && (*p) <= 42 ) {
842
832
  _widec = (short)(128 + ((*p) - -128));
843
833
  if (
844
- #line 492 "parser.rl"
834
+ #line 482 "parser.rl"
845
835
  json->allow_trailing_comma ) _widec += 256;
846
836
  }
847
837
  } else {
848
838
  _widec = (short)(128 + ((*p) - -128));
849
839
  if (
850
- #line 492 "parser.rl"
840
+ #line 482 "parser.rl"
851
841
  json->allow_trailing_comma ) _widec += 256;
852
842
  }
853
843
  } else if ( (*p) > 46 ) {
@@ -855,19 +845,19 @@ case 22:
855
845
  if ( 48 <= (*p) )
856
846
  { _widec = (short)(128 + ((*p) - -128));
857
847
  if (
858
- #line 492 "parser.rl"
848
+ #line 482 "parser.rl"
859
849
  json->allow_trailing_comma ) _widec += 256;
860
850
  }
861
851
  } else if ( (*p) >= 47 ) {
862
852
  _widec = (short)(128 + ((*p) - -128));
863
853
  if (
864
- #line 492 "parser.rl"
854
+ #line 482 "parser.rl"
865
855
  json->allow_trailing_comma ) _widec += 256;
866
856
  }
867
857
  } else {
868
858
  _widec = (short)(128 + ((*p) - -128));
869
859
  if (
870
- #line 492 "parser.rl"
860
+ #line 482 "parser.rl"
871
861
  json->allow_trailing_comma ) _widec += 256;
872
862
  }
873
863
  switch( _widec ) {
@@ -891,20 +881,20 @@ case 23:
891
881
  if ( (*p) <= 9 ) {
892
882
  _widec = (short)(128 + ((*p) - -128));
893
883
  if (
894
- #line 492 "parser.rl"
884
+ #line 482 "parser.rl"
895
885
  json->allow_trailing_comma ) _widec += 256;
896
886
  }
897
887
  } else if ( (*p) > 10 ) {
898
888
  if ( 11 <= (*p) )
899
889
  { _widec = (short)(128 + ((*p) - -128));
900
890
  if (
901
- #line 492 "parser.rl"
891
+ #line 482 "parser.rl"
902
892
  json->allow_trailing_comma ) _widec += 256;
903
893
  }
904
894
  } else {
905
895
  _widec = (short)(128 + ((*p) - -128));
906
896
  if (
907
- #line 492 "parser.rl"
897
+ #line 482 "parser.rl"
908
898
  json->allow_trailing_comma ) _widec += 256;
909
899
  }
910
900
  switch( _widec ) {
@@ -1018,7 +1008,7 @@ case 31:
1018
1008
  _out: {}
1019
1009
  }
1020
1010
 
1021
- #line 531 "parser.rl"
1011
+ #line 521 "parser.rl"
1022
1012
 
1023
1013
  if (cs >= JSON_object_first_final) {
1024
1014
  long count = json->stack->head - stack_head;
@@ -1069,7 +1059,7 @@ case 31:
1069
1059
  }
1070
1060
 
1071
1061
 
1072
- #line 1073 "parser.c"
1062
+ #line 1063 "parser.c"
1073
1063
  enum {JSON_value_start = 1};
1074
1064
  enum {JSON_value_first_final = 29};
1075
1065
  enum {JSON_value_error = 0};
@@ -1077,7 +1067,7 @@ enum {JSON_value_error = 0};
1077
1067
  enum {JSON_value_en_main = 1};
1078
1068
 
1079
1069
 
1080
- #line 664 "parser.rl"
1070
+ #line 654 "parser.rl"
1081
1071
 
1082
1072
 
1083
1073
  static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *result, int current_nesting)
@@ -1085,14 +1075,14 @@ static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *resul
1085
1075
  int cs = EVIL;
1086
1076
 
1087
1077
 
1088
- #line 1089 "parser.c"
1078
+ #line 1079 "parser.c"
1089
1079
  {
1090
1080
  cs = JSON_value_start;
1091
1081
  }
1092
1082
 
1093
- #line 671 "parser.rl"
1083
+ #line 661 "parser.rl"
1094
1084
 
1095
- #line 1096 "parser.c"
1085
+ #line 1086 "parser.c"
1096
1086
  {
1097
1087
  if ( p == pe )
1098
1088
  goto _test_eof;
@@ -1126,7 +1116,7 @@ st0:
1126
1116
  cs = 0;
1127
1117
  goto _out;
1128
1118
  tr2:
1129
- #line 609 "parser.rl"
1119
+ #line 599 "parser.rl"
1130
1120
  {
1131
1121
  char *np = JSON_parse_string(json, p, pe, result);
1132
1122
  if (np == NULL) {
@@ -1138,7 +1128,7 @@ tr2:
1138
1128
  }
1139
1129
  goto st29;
1140
1130
  tr3:
1141
- #line 619 "parser.rl"
1131
+ #line 609 "parser.rl"
1142
1132
  {
1143
1133
  char *np;
1144
1134
  if(pe > p + 8 && !strncmp(MinusInfinity, p, 9)) {
@@ -1158,7 +1148,7 @@ tr3:
1158
1148
  }
1159
1149
  goto st29;
1160
1150
  tr7:
1161
- #line 637 "parser.rl"
1151
+ #line 627 "parser.rl"
1162
1152
  {
1163
1153
  char *np;
1164
1154
  json->in_array++;
@@ -1168,7 +1158,7 @@ tr7:
1168
1158
  }
1169
1159
  goto st29;
1170
1160
  tr11:
1171
- #line 645 "parser.rl"
1161
+ #line 635 "parser.rl"
1172
1162
  {
1173
1163
  char *np;
1174
1164
  np = JSON_parse_object(json, p, pe, result, current_nesting + 1);
@@ -1176,7 +1166,7 @@ tr11:
1176
1166
  }
1177
1167
  goto st29;
1178
1168
  tr25:
1179
- #line 602 "parser.rl"
1169
+ #line 592 "parser.rl"
1180
1170
  {
1181
1171
  if (json->allow_nan) {
1182
1172
  *result = CInfinity;
@@ -1186,7 +1176,7 @@ tr25:
1186
1176
  }
1187
1177
  goto st29;
1188
1178
  tr27:
1189
- #line 595 "parser.rl"
1179
+ #line 585 "parser.rl"
1190
1180
  {
1191
1181
  if (json->allow_nan) {
1192
1182
  *result = CNaN;
@@ -1196,19 +1186,19 @@ tr27:
1196
1186
  }
1197
1187
  goto st29;
1198
1188
  tr31:
1199
- #line 589 "parser.rl"
1189
+ #line 579 "parser.rl"
1200
1190
  {
1201
1191
  *result = Qfalse;
1202
1192
  }
1203
1193
  goto st29;
1204
1194
  tr34:
1205
- #line 586 "parser.rl"
1195
+ #line 576 "parser.rl"
1206
1196
  {
1207
1197
  *result = Qnil;
1208
1198
  }
1209
1199
  goto st29;
1210
1200
  tr37:
1211
- #line 592 "parser.rl"
1201
+ #line 582 "parser.rl"
1212
1202
  {
1213
1203
  *result = Qtrue;
1214
1204
  }
@@ -1217,9 +1207,9 @@ st29:
1217
1207
  if ( ++p == pe )
1218
1208
  goto _test_eof29;
1219
1209
  case 29:
1220
- #line 651 "parser.rl"
1210
+ #line 641 "parser.rl"
1221
1211
  { p--; {p++; cs = 29; goto _out;} }
1222
- #line 1223 "parser.c"
1212
+ #line 1213 "parser.c"
1223
1213
  switch( (*p) ) {
1224
1214
  case 13: goto st29;
1225
1215
  case 32: goto st29;
@@ -1460,7 +1450,7 @@ case 28:
1460
1450
  _out: {}
1461
1451
  }
1462
1452
 
1463
- #line 672 "parser.rl"
1453
+ #line 662 "parser.rl"
1464
1454
 
1465
1455
  if (json->freeze) {
1466
1456
  OBJ_FREEZE(*result);
@@ -1475,7 +1465,7 @@ case 28:
1475
1465
  }
1476
1466
 
1477
1467
 
1478
- #line 1479 "parser.c"
1468
+ #line 1469 "parser.c"
1479
1469
  enum {JSON_integer_start = 1};
1480
1470
  enum {JSON_integer_first_final = 3};
1481
1471
  enum {JSON_integer_error = 0};
@@ -1483,7 +1473,7 @@ enum {JSON_integer_error = 0};
1483
1473
  enum {JSON_integer_en_main = 1};
1484
1474
 
1485
1475
 
1486
- #line 693 "parser.rl"
1476
+ #line 683 "parser.rl"
1487
1477
 
1488
1478
 
1489
1479
  #define MAX_FAST_INTEGER_SIZE 18
@@ -1523,7 +1513,7 @@ static char *JSON_decode_integer(JSON_Parser *json, char *p, VALUE *result)
1523
1513
  }
1524
1514
 
1525
1515
 
1526
- #line 1527 "parser.c"
1516
+ #line 1517 "parser.c"
1527
1517
  enum {JSON_float_start = 1};
1528
1518
  enum {JSON_float_first_final = 6};
1529
1519
  enum {JSON_float_error = 0};
@@ -1531,7 +1521,7 @@ enum {JSON_float_error = 0};
1531
1521
  enum {JSON_float_en_main = 1};
1532
1522
 
1533
1523
 
1534
- #line 745 "parser.rl"
1524
+ #line 735 "parser.rl"
1535
1525
 
1536
1526
 
1537
1527
  static char *JSON_parse_number(JSON_Parser *json, char *p, char *pe, VALUE *result)
@@ -1540,15 +1530,15 @@ static char *JSON_parse_number(JSON_Parser *json, char *p, char *pe, VALUE *resu
1540
1530
  bool is_float = false;
1541
1531
 
1542
1532
 
1543
- #line 1544 "parser.c"
1533
+ #line 1534 "parser.c"
1544
1534
  {
1545
1535
  cs = JSON_float_start;
1546
1536
  }
1547
1537
 
1548
- #line 753 "parser.rl"
1538
+ #line 743 "parser.rl"
1549
1539
  json->memo = p;
1550
1540
 
1551
- #line 1552 "parser.c"
1541
+ #line 1542 "parser.c"
1552
1542
  {
1553
1543
  if ( p == pe )
1554
1544
  goto _test_eof;
@@ -1588,24 +1578,24 @@ case 6:
1588
1578
  goto st0;
1589
1579
  goto tr7;
1590
1580
  tr7:
1591
- #line 737 "parser.rl"
1581
+ #line 727 "parser.rl"
1592
1582
  { p--; {p++; cs = 7; goto _out;} }
1593
1583
  goto st7;
1594
1584
  st7:
1595
1585
  if ( ++p == pe )
1596
1586
  goto _test_eof7;
1597
1587
  case 7:
1598
- #line 1599 "parser.c"
1588
+ #line 1589 "parser.c"
1599
1589
  goto st0;
1600
1590
  tr8:
1601
- #line 738 "parser.rl"
1591
+ #line 728 "parser.rl"
1602
1592
  { is_float = true; }
1603
1593
  goto st3;
1604
1594
  st3:
1605
1595
  if ( ++p == pe )
1606
1596
  goto _test_eof3;
1607
1597
  case 3:
1608
- #line 1609 "parser.c"
1598
+ #line 1599 "parser.c"
1609
1599
  if ( 48 <= (*p) && (*p) <= 57 )
1610
1600
  goto st8;
1611
1601
  goto st0;
@@ -1624,14 +1614,14 @@ case 8:
1624
1614
  goto st0;
1625
1615
  goto tr7;
1626
1616
  tr9:
1627
- #line 738 "parser.rl"
1617
+ #line 728 "parser.rl"
1628
1618
  { is_float = true; }
1629
1619
  goto st4;
1630
1620
  st4:
1631
1621
  if ( ++p == pe )
1632
1622
  goto _test_eof4;
1633
1623
  case 4:
1634
- #line 1635 "parser.c"
1624
+ #line 1625 "parser.c"
1635
1625
  switch( (*p) ) {
1636
1626
  case 43: goto st5;
1637
1627
  case 45: goto st5;
@@ -1688,7 +1678,7 @@ case 10:
1688
1678
  _out: {}
1689
1679
  }
1690
1680
 
1691
- #line 755 "parser.rl"
1681
+ #line 745 "parser.rl"
1692
1682
 
1693
1683
  if (cs >= JSON_float_first_final) {
1694
1684
  if (!is_float) {
@@ -1744,7 +1734,7 @@ case 10:
1744
1734
 
1745
1735
 
1746
1736
 
1747
- #line 1748 "parser.c"
1737
+ #line 1738 "parser.c"
1748
1738
  enum {JSON_array_start = 1};
1749
1739
  enum {JSON_array_first_final = 22};
1750
1740
  enum {JSON_array_error = 0};
@@ -1752,7 +1742,7 @@ enum {JSON_array_error = 0};
1752
1742
  enum {JSON_array_en_main = 1};
1753
1743
 
1754
1744
 
1755
- #line 835 "parser.rl"
1745
+ #line 825 "parser.rl"
1756
1746
 
1757
1747
 
1758
1748
  static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *result, int current_nesting)
@@ -1765,14 +1755,14 @@ static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *resul
1765
1755
  long stack_head = json->stack->head;
1766
1756
 
1767
1757
 
1768
- #line 1769 "parser.c"
1758
+ #line 1759 "parser.c"
1769
1759
  {
1770
1760
  cs = JSON_array_start;
1771
1761
  }
1772
1762
 
1773
- #line 847 "parser.rl"
1763
+ #line 837 "parser.rl"
1774
1764
 
1775
- #line 1776 "parser.c"
1765
+ #line 1766 "parser.c"
1776
1766
  {
1777
1767
  short _widec;
1778
1768
  if ( p == pe )
@@ -1812,7 +1802,7 @@ case 2:
1812
1802
  goto st2;
1813
1803
  goto st0;
1814
1804
  tr2:
1815
- #line 815 "parser.rl"
1805
+ #line 805 "parser.rl"
1816
1806
  {
1817
1807
  VALUE v = Qnil;
1818
1808
  char *np = JSON_parse_value(json, p, pe, &v, current_nesting);
@@ -1827,12 +1817,12 @@ st3:
1827
1817
  if ( ++p == pe )
1828
1818
  goto _test_eof3;
1829
1819
  case 3:
1830
- #line 1831 "parser.c"
1820
+ #line 1821 "parser.c"
1831
1821
  _widec = (*p);
1832
1822
  if ( 44 <= (*p) && (*p) <= 44 ) {
1833
1823
  _widec = (short)(128 + ((*p) - -128));
1834
1824
  if (
1835
- #line 825 "parser.rl"
1825
+ #line 815 "parser.rl"
1836
1826
  json->allow_trailing_comma ) _widec += 256;
1837
1827
  }
1838
1828
  switch( _widec ) {
@@ -1879,14 +1869,14 @@ case 7:
1879
1869
  goto st3;
1880
1870
  goto st7;
1881
1871
  tr4:
1882
- #line 827 "parser.rl"
1872
+ #line 817 "parser.rl"
1883
1873
  { p--; {p++; cs = 22; goto _out;} }
1884
1874
  goto st22;
1885
1875
  st22:
1886
1876
  if ( ++p == pe )
1887
1877
  goto _test_eof22;
1888
1878
  case 22:
1889
- #line 1890 "parser.c"
1879
+ #line 1880 "parser.c"
1890
1880
  goto st0;
1891
1881
  st8:
1892
1882
  if ( ++p == pe )
@@ -1954,13 +1944,13 @@ case 13:
1954
1944
  if ( 10 <= (*p) && (*p) <= 10 ) {
1955
1945
  _widec = (short)(128 + ((*p) - -128));
1956
1946
  if (
1957
- #line 825 "parser.rl"
1947
+ #line 815 "parser.rl"
1958
1948
  json->allow_trailing_comma ) _widec += 256;
1959
1949
  }
1960
1950
  } else if ( (*p) >= 9 ) {
1961
1951
  _widec = (short)(128 + ((*p) - -128));
1962
1952
  if (
1963
- #line 825 "parser.rl"
1953
+ #line 815 "parser.rl"
1964
1954
  json->allow_trailing_comma ) _widec += 256;
1965
1955
  }
1966
1956
  } else if ( (*p) > 13 ) {
@@ -1968,19 +1958,19 @@ case 13:
1968
1958
  if ( 47 <= (*p) && (*p) <= 47 ) {
1969
1959
  _widec = (short)(128 + ((*p) - -128));
1970
1960
  if (
1971
- #line 825 "parser.rl"
1961
+ #line 815 "parser.rl"
1972
1962
  json->allow_trailing_comma ) _widec += 256;
1973
1963
  }
1974
1964
  } else if ( (*p) >= 32 ) {
1975
1965
  _widec = (short)(128 + ((*p) - -128));
1976
1966
  if (
1977
- #line 825 "parser.rl"
1967
+ #line 815 "parser.rl"
1978
1968
  json->allow_trailing_comma ) _widec += 256;
1979
1969
  }
1980
1970
  } else {
1981
1971
  _widec = (short)(128 + ((*p) - -128));
1982
1972
  if (
1983
- #line 825 "parser.rl"
1973
+ #line 815 "parser.rl"
1984
1974
  json->allow_trailing_comma ) _widec += 256;
1985
1975
  }
1986
1976
  switch( _widec ) {
@@ -2019,13 +2009,13 @@ case 14:
2019
2009
  if ( 47 <= (*p) && (*p) <= 47 ) {
2020
2010
  _widec = (short)(128 + ((*p) - -128));
2021
2011
  if (
2022
- #line 825 "parser.rl"
2012
+ #line 815 "parser.rl"
2023
2013
  json->allow_trailing_comma ) _widec += 256;
2024
2014
  }
2025
2015
  } else if ( (*p) >= 42 ) {
2026
2016
  _widec = (short)(128 + ((*p) - -128));
2027
2017
  if (
2028
- #line 825 "parser.rl"
2018
+ #line 815 "parser.rl"
2029
2019
  json->allow_trailing_comma ) _widec += 256;
2030
2020
  }
2031
2021
  switch( _widec ) {
@@ -2044,20 +2034,20 @@ case 15:
2044
2034
  if ( (*p) <= 41 ) {
2045
2035
  _widec = (short)(128 + ((*p) - -128));
2046
2036
  if (
2047
- #line 825 "parser.rl"
2037
+ #line 815 "parser.rl"
2048
2038
  json->allow_trailing_comma ) _widec += 256;
2049
2039
  }
2050
2040
  } else if ( (*p) > 42 ) {
2051
2041
  if ( 43 <= (*p) )
2052
2042
  { _widec = (short)(128 + ((*p) - -128));
2053
2043
  if (
2054
- #line 825 "parser.rl"
2044
+ #line 815 "parser.rl"
2055
2045
  json->allow_trailing_comma ) _widec += 256;
2056
2046
  }
2057
2047
  } else {
2058
2048
  _widec = (short)(128 + ((*p) - -128));
2059
2049
  if (
2060
- #line 825 "parser.rl"
2050
+ #line 815 "parser.rl"
2061
2051
  json->allow_trailing_comma ) _widec += 256;
2062
2052
  }
2063
2053
  switch( _widec ) {
@@ -2080,13 +2070,13 @@ case 16:
2080
2070
  if ( 42 <= (*p) && (*p) <= 42 ) {
2081
2071
  _widec = (short)(128 + ((*p) - -128));
2082
2072
  if (
2083
- #line 825 "parser.rl"
2073
+ #line 815 "parser.rl"
2084
2074
  json->allow_trailing_comma ) _widec += 256;
2085
2075
  }
2086
2076
  } else {
2087
2077
  _widec = (short)(128 + ((*p) - -128));
2088
2078
  if (
2089
- #line 825 "parser.rl"
2079
+ #line 815 "parser.rl"
2090
2080
  json->allow_trailing_comma ) _widec += 256;
2091
2081
  }
2092
2082
  } else if ( (*p) > 46 ) {
@@ -2094,19 +2084,19 @@ case 16:
2094
2084
  if ( 48 <= (*p) )
2095
2085
  { _widec = (short)(128 + ((*p) - -128));
2096
2086
  if (
2097
- #line 825 "parser.rl"
2087
+ #line 815 "parser.rl"
2098
2088
  json->allow_trailing_comma ) _widec += 256;
2099
2089
  }
2100
2090
  } else if ( (*p) >= 47 ) {
2101
2091
  _widec = (short)(128 + ((*p) - -128));
2102
2092
  if (
2103
- #line 825 "parser.rl"
2093
+ #line 815 "parser.rl"
2104
2094
  json->allow_trailing_comma ) _widec += 256;
2105
2095
  }
2106
2096
  } else {
2107
2097
  _widec = (short)(128 + ((*p) - -128));
2108
2098
  if (
2109
- #line 825 "parser.rl"
2099
+ #line 815 "parser.rl"
2110
2100
  json->allow_trailing_comma ) _widec += 256;
2111
2101
  }
2112
2102
  switch( _widec ) {
@@ -2130,20 +2120,20 @@ case 17:
2130
2120
  if ( (*p) <= 9 ) {
2131
2121
  _widec = (short)(128 + ((*p) - -128));
2132
2122
  if (
2133
- #line 825 "parser.rl"
2123
+ #line 815 "parser.rl"
2134
2124
  json->allow_trailing_comma ) _widec += 256;
2135
2125
  }
2136
2126
  } else if ( (*p) > 10 ) {
2137
2127
  if ( 11 <= (*p) )
2138
2128
  { _widec = (short)(128 + ((*p) - -128));
2139
2129
  if (
2140
- #line 825 "parser.rl"
2130
+ #line 815 "parser.rl"
2141
2131
  json->allow_trailing_comma ) _widec += 256;
2142
2132
  }
2143
2133
  } else {
2144
2134
  _widec = (short)(128 + ((*p) - -128));
2145
2135
  if (
2146
- #line 825 "parser.rl"
2136
+ #line 815 "parser.rl"
2147
2137
  json->allow_trailing_comma ) _widec += 256;
2148
2138
  }
2149
2139
  switch( _widec ) {
@@ -2215,7 +2205,7 @@ case 21:
2215
2205
  _out: {}
2216
2206
  }
2217
2207
 
2218
- #line 848 "parser.rl"
2208
+ #line 838 "parser.rl"
2219
2209
 
2220
2210
  if(cs >= JSON_array_first_final) {
2221
2211
  long count = json->stack->head - stack_head;
@@ -2409,7 +2399,7 @@ static VALUE json_string_unescape(JSON_Parser *json, char *string, char *stringE
2409
2399
  }
2410
2400
 
2411
2401
 
2412
- #line 2413 "parser.c"
2402
+ #line 2403 "parser.c"
2413
2403
  enum {JSON_string_start = 1};
2414
2404
  enum {JSON_string_first_final = 9};
2415
2405
  enum {JSON_string_error = 0};
@@ -2417,7 +2407,7 @@ enum {JSON_string_error = 0};
2417
2407
  enum {JSON_string_en_main = 1};
2418
2408
 
2419
2409
 
2420
- #line 1071 "parser.rl"
2410
+ #line 1061 "parser.rl"
2421
2411
 
2422
2412
 
2423
2413
  static int
@@ -2438,15 +2428,15 @@ static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *resu
2438
2428
  VALUE match_string;
2439
2429
 
2440
2430
 
2441
- #line 2442 "parser.c"
2431
+ #line 2432 "parser.c"
2442
2432
  {
2443
2433
  cs = JSON_string_start;
2444
2434
  }
2445
2435
 
2446
- #line 1091 "parser.rl"
2436
+ #line 1081 "parser.rl"
2447
2437
  json->memo = p;
2448
2438
 
2449
- #line 2450 "parser.c"
2439
+ #line 2440 "parser.c"
2450
2440
  {
2451
2441
  if ( p == pe )
2452
2442
  goto _test_eof;
@@ -2471,14 +2461,14 @@ case 2:
2471
2461
  goto st0;
2472
2462
  goto st2;
2473
2463
  tr2:
2474
- #line 1053 "parser.rl"
2464
+ #line 1043 "parser.rl"
2475
2465
  {
2476
2466
  *result = json_string_fastpath(json, json->memo + 1, p, json->parsing_name, json->parsing_name || json-> freeze, json->parsing_name && json->symbolize_names);
2477
2467
  {p = (( p + 1))-1;}
2478
2468
  p--;
2479
2469
  {p++; cs = 9; goto _out;}
2480
2470
  }
2481
- #line 1046 "parser.rl"
2471
+ #line 1036 "parser.rl"
2482
2472
  {
2483
2473
  *result = json_string_unescape(json, json->memo + 1, p, json->parsing_name, json->parsing_name || json-> freeze, json->parsing_name && json->symbolize_names);
2484
2474
  {p = (( p + 1))-1;}
@@ -2487,7 +2477,7 @@ tr2:
2487
2477
  }
2488
2478
  goto st9;
2489
2479
  tr6:
2490
- #line 1046 "parser.rl"
2480
+ #line 1036 "parser.rl"
2491
2481
  {
2492
2482
  *result = json_string_unescape(json, json->memo + 1, p, json->parsing_name, json->parsing_name || json-> freeze, json->parsing_name && json->symbolize_names);
2493
2483
  {p = (( p + 1))-1;}
@@ -2499,7 +2489,7 @@ st9:
2499
2489
  if ( ++p == pe )
2500
2490
  goto _test_eof9;
2501
2491
  case 9:
2502
- #line 2503 "parser.c"
2492
+ #line 2493 "parser.c"
2503
2493
  goto st0;
2504
2494
  st3:
2505
2495
  if ( ++p == pe )
@@ -2587,7 +2577,7 @@ case 8:
2587
2577
  _out: {}
2588
2578
  }
2589
2579
 
2590
- #line 1093 "parser.rl"
2580
+ #line 1083 "parser.rl"
2591
2581
 
2592
2582
  if (json->create_additions && RTEST(match_string = json->match_string)) {
2593
2583
  VALUE klass;
@@ -2740,7 +2730,7 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
2740
2730
  }
2741
2731
 
2742
2732
 
2743
- #line 2744 "parser.c"
2733
+ #line 2734 "parser.c"
2744
2734
  enum {JSON_start = 1};
2745
2735
  enum {JSON_first_final = 10};
2746
2736
  enum {JSON_error = 0};
@@ -2748,7 +2738,7 @@ enum {JSON_error = 0};
2748
2738
  enum {JSON_en_main = 1};
2749
2739
 
2750
2740
 
2751
- #line 1259 "parser.rl"
2741
+ #line 1249 "parser.rl"
2752
2742
 
2753
2743
 
2754
2744
  /*
@@ -2777,16 +2767,16 @@ static VALUE cParser_parse(VALUE self)
2777
2767
  json->stack = &stack;
2778
2768
 
2779
2769
 
2780
- #line 2781 "parser.c"
2770
+ #line 2771 "parser.c"
2781
2771
  {
2782
2772
  cs = JSON_start;
2783
2773
  }
2784
2774
 
2785
- #line 1287 "parser.rl"
2775
+ #line 1277 "parser.rl"
2786
2776
  p = json->source;
2787
2777
  pe = p + json->len;
2788
2778
 
2789
- #line 2790 "parser.c"
2779
+ #line 2780 "parser.c"
2790
2780
  {
2791
2781
  if ( p == pe )
2792
2782
  goto _test_eof;
@@ -2820,7 +2810,7 @@ st0:
2820
2810
  cs = 0;
2821
2811
  goto _out;
2822
2812
  tr2:
2823
- #line 1251 "parser.rl"
2813
+ #line 1241 "parser.rl"
2824
2814
  {
2825
2815
  char *np = JSON_parse_value(json, p, pe, &result, 0);
2826
2816
  if (np == NULL) { p--; {p++; cs = 10; goto _out;} } else {p = (( np))-1;}
@@ -2830,7 +2820,7 @@ st10:
2830
2820
  if ( ++p == pe )
2831
2821
  goto _test_eof10;
2832
2822
  case 10:
2833
- #line 2834 "parser.c"
2823
+ #line 2824 "parser.c"
2834
2824
  switch( (*p) ) {
2835
2825
  case 13: goto st10;
2836
2826
  case 32: goto st10;
@@ -2919,7 +2909,7 @@ case 9:
2919
2909
  _out: {}
2920
2910
  }
2921
2911
 
2922
- #line 1290 "parser.rl"
2912
+ #line 1280 "parser.rl"
2923
2913
 
2924
2914
  if (json->stack_handle) {
2925
2915
  rvalue_stack_eagerly_release(json->stack_handle);
@@ -2955,16 +2945,16 @@ static VALUE cParser_m_parse(VALUE klass, VALUE source, VALUE opts)
2955
2945
  json->stack = &stack;
2956
2946
 
2957
2947
 
2958
- #line 2959 "parser.c"
2948
+ #line 2949 "parser.c"
2959
2949
  {
2960
2950
  cs = JSON_start;
2961
2951
  }
2962
2952
 
2963
- #line 1325 "parser.rl"
2953
+ #line 1315 "parser.rl"
2964
2954
  p = json->source;
2965
2955
  pe = p + json->len;
2966
2956
 
2967
- #line 2968 "parser.c"
2957
+ #line 2958 "parser.c"
2968
2958
  {
2969
2959
  if ( p == pe )
2970
2960
  goto _test_eof;
@@ -2998,7 +2988,7 @@ st0:
2998
2988
  cs = 0;
2999
2989
  goto _out;
3000
2990
  tr2:
3001
- #line 1251 "parser.rl"
2991
+ #line 1241 "parser.rl"
3002
2992
  {
3003
2993
  char *np = JSON_parse_value(json, p, pe, &result, 0);
3004
2994
  if (np == NULL) { p--; {p++; cs = 10; goto _out;} } else {p = (( np))-1;}
@@ -3008,7 +2998,7 @@ st10:
3008
2998
  if ( ++p == pe )
3009
2999
  goto _test_eof10;
3010
3000
  case 10:
3011
- #line 3012 "parser.c"
3001
+ #line 3002 "parser.c"
3012
3002
  switch( (*p) ) {
3013
3003
  case 13: goto st10;
3014
3004
  case 32: goto st10;
@@ -3097,7 +3087,7 @@ case 9:
3097
3087
  _out: {}
3098
3088
  }
3099
3089
 
3100
- #line 1328 "parser.rl"
3090
+ #line 1318 "parser.rl"
3101
3091
 
3102
3092
  if (json->stack_handle) {
3103
3093
  rvalue_stack_eagerly_release(json->stack_handle);
@@ -3122,8 +3112,10 @@ static void JSON_mark(void *ptr)
3122
3112
  rb_gc_mark(json->match_string);
3123
3113
  rb_gc_mark(json->stack_handle);
3124
3114
 
3125
- const VALUE *name_cache_entries = &json->name_cache.entries[0];
3126
- rb_gc_mark_locations(name_cache_entries, name_cache_entries + json->name_cache.length);
3115
+ long index;
3116
+ for (index = 0; index < json->name_cache.length; index++) {
3117
+ rb_gc_mark(json->name_cache.entries[index]);
3118
+ }
3127
3119
  }
3128
3120
 
3129
3121
  static void JSON_free(void *ptr)