Skip to content

Commit d77c4e3

Browse files
authored
Merge pull request #618 from byroot/dead-includes
Get rid of compatibility code for older rubies
2 parents 83e7e1a + 811297f commit d77c4e3

File tree

2 files changed

+0
-44
lines changed

2 files changed

+0
-44
lines changed

ext/json/ext/generator/generator.h

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,6 @@ typedef unsigned char _Bool;
2323
#endif
2424
#endif
2525

26-
#ifdef HAVE_RUBY_RE_H
27-
#include "ruby/re.h"
28-
#else
29-
#include "re.h"
30-
#endif
31-
32-
#ifndef rb_intern_str
33-
#define rb_intern_str(string) SYM2ID(rb_str_intern(string))
34-
#endif
35-
36-
#ifndef rb_obj_instance_variables
37-
#define rb_obj_instance_variables(object) rb_funcall(object, rb_intern("instance_variables"), 0)
38-
#endif
39-
40-
#define option_given_p(opts, key) RTEST(rb_funcall(opts, i_key_p, 1, key))
41-
4226
static void convert_UTF8_to_JSON(FBuffer *out_buffer, VALUE in_string, bool out_ascii_only, bool out_script_safe);
4327
static char *fstrndup(const char *ptr, unsigned long len);
4428

@@ -140,15 +124,6 @@ static VALUE cState_script_safe_set(VALUE self, VALUE depth);
140124
static VALUE cState_strict(VALUE self);
141125
static VALUE cState_strict_set(VALUE self, VALUE strict);
142126
static FBuffer *cState_prepare_buffer(VALUE self);
143-
#ifndef ZALLOC
144-
#define ZALLOC(type) ((type *)ruby_zalloc(sizeof(type)))
145-
static inline void *ruby_zalloc(size_t n)
146-
{
147-
void *p = ruby_xmalloc(n);
148-
memset(p, 0, n);
149-
return p;
150-
}
151-
#endif
152127

153128
static const rb_data_type_t JSON_Generator_State_type;
154129

ext/json/ext/parser/parser.h

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,6 @@
33

44
#include "ruby.h"
55

6-
#ifndef HAVE_RUBY_RE_H
7-
#include "re.h"
8-
#endif
9-
10-
#ifdef HAVE_RUBY_ST_H
11-
#include "ruby/st.h"
12-
#else
13-
#include "st.h"
14-
#endif
15-
166
#ifndef MAYBE_UNUSED
177
# define MAYBE_UNUSED(x) x
188
#endif
@@ -64,15 +54,6 @@ static void JSON_mark(void *json);
6454
static void JSON_free(void *json);
6555
static VALUE cJSON_parser_s_allocate(VALUE klass);
6656
static VALUE cParser_source(VALUE self);
67-
#ifndef ZALLOC
68-
#define ZALLOC(type) ((type *)ruby_zalloc(sizeof(type)))
69-
static inline void *ruby_zalloc(size_t n)
70-
{
71-
void *p = ruby_xmalloc(n);
72-
memset(p, 0, n);
73-
return p;
74-
}
75-
#endif
7657

7758
static const rb_data_type_t JSON_Parser_type;
7859

0 commit comments

Comments
 (0)