From 3b0dccfce69c5acac654d6922431121d4b96340d Mon Sep 17 00:00:00 2001 From: Oleg Z Date: Tue, 16 Sep 2014 14:23:24 -0500 Subject: [PATCH 1/2] Make it work with ruby 2.1 --- ext/extconf.rb | 1 + ext/native_server.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ext/extconf.rb b/ext/extconf.rb index 7075478..de7cac9 100644 --- a/ext/extconf.rb +++ b/ext/extconf.rb @@ -68,6 +68,7 @@ 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/ puts "*** Using Ruby version: #{RUBY_VERSION}" puts "*** with CPPFLAGS: #{$CPPFLAGS}" diff --git a/ext/native_server.c b/ext/native_server.c index 11aee49..6f39465 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) #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) From 9df80120a4fd9d4372fb665f745ef262c07b1efd Mon Sep 17 00:00:00 2001 From: James Poore Date: Mon, 30 Nov 2015 11:50:38 -0600 Subject: [PATCH 2/2] add support for Ruby 2.2.x --- ext/extconf.rb | 1 + ext/native_server.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ext/extconf.rb b/ext/extconf.rb index de7cac9..aa72f54 100644 --- a/ext/extconf.rb +++ b/ext/extconf.rb @@ -69,6 +69,7 @@ def copy_gem(gem_dir) $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 6f39465..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) || defined(RUBY_21) +#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)