diff --git a/ext/extconf.rb b/ext/extconf.rb index 7075478..aa72f54 100644 --- a/ext/extconf.rb +++ b/ext/extconf.rb @@ -68,6 +68,8 @@ def copy_gem(gem_dir) # thanks to: https://gist.github.com/IanVaughan/5489431 $CPPFLAGS += " -DRUBY_19" if RUBY_VERSION =~ /1.9/ $CPPFLAGS += " -DRUBY_20" if RUBY_VERSION =~ /2.0/ +$CPPFLAGS += " -DRUBY_21" if RUBY_VERSION =~ /2.1/ +$CPPFLAGS += " -DRUBY_22" if RUBY_VERSION =~ /2.2/ puts "*** Using Ruby version: #{RUBY_VERSION}" puts "*** with CPPFLAGS: #{$CPPFLAGS}" diff --git a/ext/native_server.c b/ext/native_server.c index 11aee49..769524f 100644 --- a/ext/native_server.c +++ b/ext/native_server.c @@ -153,7 +153,7 @@ static VALUE mc_initialize(VALUE self, VALUE opts) { return self; } -#if defined(RUBY_19) || defined(RUBY_20) +#if defined(RUBY_19) || defined(RUBY_20) || defined(RUBY_21) || defined(RUBY_22) #define RSTRING_SET_LEN(str, newlen) (rb_str_set_len(str, new_len)) #else #define RSTRING_SET_LEN(str, newlen) (RSTRING(str)->len = new_len)