summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/json/ext/generator/generator.c2
-rw-r--r--ext/json/ext/parser/parser.c68
-rw-r--r--ext/json/ext/parser/parser.rl2
3 files changed, 39 insertions, 33 deletions
diff --git a/ext/json/ext/generator/generator.c b/ext/json/ext/generator/generator.c
index 9f510f5..9a0b383 100644
--- a/ext/json/ext/generator/generator.c
+++ b/ext/json/ext/generator/generator.c
@@ -518,8 +518,10 @@ static size_t State_memsize(const void *ptr)
static const rb_data_type_t JSON_Generator_State_type = {
"JSON/Generator/State",
{NULL, State_free, State_memsize,},
+#ifdef RUBY_TYPED_FREE_IMMEDIATELY
0, 0,
RUBY_TYPED_FREE_IMMEDIATELY,
+#endif
};
static JSON_Generator_State *State_allocate(void)
diff --git a/ext/json/ext/parser/parser.c b/ext/json/ext/parser/parser.c
index 560aa89..509d1fc 100644
--- a/ext/json/ext/parser/parser.c
+++ b/ext/json/ext/parser/parser.c
@@ -89,11 +89,11 @@ static ID i_json_creatable_p, i_json_create, i_create_id, i_create_additions,
#line 92 "parser.c"
-enum {JSON_object_start = 1};
-enum {JSON_object_first_final = 27};
-enum {JSON_object_error = 0};
+static const int JSON_object_start = 1;
+static const int JSON_object_first_final = 27;
+static const int JSON_object_error = 0;
-enum {JSON_object_en_main = 1};
+static const int JSON_object_en_main = 1;
#line 151 "parser.rl"
@@ -467,11 +467,11 @@ case 26:
#line 470 "parser.c"
-enum {JSON_value_start = 1};
-enum {JSON_value_first_final = 21};
-enum {JSON_value_error = 0};
+static const int JSON_value_start = 1;
+static const int JSON_value_first_final = 21;
+static const int JSON_value_error = 0;
-enum {JSON_value_en_main = 1};
+static const int JSON_value_en_main = 1;
#line 271 "parser.rl"
@@ -776,11 +776,11 @@ case 20:
#line 779 "parser.c"
-enum {JSON_integer_start = 1};
-enum {JSON_integer_first_final = 3};
-enum {JSON_integer_error = 0};
+static const int JSON_integer_start = 1;
+static const int JSON_integer_first_final = 3;
+static const int JSON_integer_error = 0;
-enum {JSON_integer_en_main = 1};
+static const int JSON_integer_en_main = 1;
#line 295 "parser.rl"
@@ -875,11 +875,11 @@ case 5:
#line 878 "parser.c"
-enum {JSON_float_start = 1};
-enum {JSON_float_first_final = 8};
-enum {JSON_float_error = 0};
+static const int JSON_float_start = 1;
+static const int JSON_float_first_final = 8;
+static const int JSON_float_error = 0;
-enum {JSON_float_en_main = 1};
+static const int JSON_float_en_main = 1;
#line 329 "parser.rl"
@@ -1041,11 +1041,11 @@ case 7:
#line 1044 "parser.c"
-enum {JSON_array_start = 1};
-enum {JSON_array_first_final = 17};
-enum {JSON_array_error = 0};
+static const int JSON_array_start = 1;
+static const int JSON_array_first_final = 17;
+static const int JSON_array_error = 0;
-enum {JSON_array_en_main = 1};
+static const int JSON_array_en_main = 1;
#line 381 "parser.rl"
@@ -1373,11 +1373,11 @@ static VALUE json_string_unescape(VALUE result, char *string, char *stringEnd)
#line 1376 "parser.c"
-enum {JSON_string_start = 1};
-enum {JSON_string_first_final = 8};
-enum {JSON_string_error = 0};
+static const int JSON_string_start = 1;
+static const int JSON_string_first_final = 8;
+static const int JSON_string_error = 0;
-enum {JSON_string_en_main = 1};
+static const int JSON_string_en_main = 1;
#line 494 "parser.rl"
@@ -1730,11 +1730,11 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
#line 1733 "parser.c"
-enum {JSON_start = 1};
-enum {JSON_first_final = 10};
-enum {JSON_error = 0};
+static const int JSON_start = 1;
+static const int JSON_first_final = 10;
+static const int JSON_error = 0;
-enum {JSON_en_main = 1};
+static const int JSON_en_main = 1;
#line 740 "parser.rl"
@@ -1904,11 +1904,11 @@ case 9:
#line 1907 "parser.c"
-enum {JSON_quirks_mode_start = 1};
-enum {JSON_quirks_mode_first_final = 10};
-enum {JSON_quirks_mode_error = 0};
+static const int JSON_quirks_mode_start = 1;
+static const int JSON_quirks_mode_first_final = 10;
+static const int JSON_quirks_mode_error = 0;
-enum {JSON_quirks_mode_en_main = 1};
+static const int JSON_quirks_mode_en_main = 1;
#line 778 "parser.rl"
@@ -2126,8 +2126,10 @@ static size_t JSON_memsize(const void *ptr)
static const rb_data_type_t JSON_Parser_type = {
"JSON/Parser",
{JSON_mark, JSON_free, JSON_memsize,},
+#ifdef RUBY_TYPED_FREE_IMMEDIATELY
0, 0,
RUBY_TYPED_FREE_IMMEDIATELY,
+#endif
};
static VALUE cJSON_parser_s_allocate(VALUE klass)
@@ -2160,7 +2162,7 @@ static VALUE cParser_quirks_mode_p(VALUE self)
}
-void Init_parser(void)
+void Init_parser()
{
rb_require("json/common");
mJSON = rb_define_module("JSON");
diff --git a/ext/json/ext/parser/parser.rl b/ext/json/ext/parser/parser.rl
index 34e30f4..391d6fb 100644
--- a/ext/json/ext/parser/parser.rl
+++ b/ext/json/ext/parser/parser.rl
@@ -849,8 +849,10 @@ static size_t JSON_memsize(const void *ptr)
static const rb_data_type_t JSON_Parser_type = {
"JSON/Parser",
{JSON_mark, JSON_free, JSON_memsize,},
+#ifdef RUBY_TYPED_FREE_IMMEDIATELY
0, 0,
RUBY_TYPED_FREE_IMMEDIATELY,
+#endif
};
static VALUE cJSON_parser_s_allocate(VALUE klass)