THRIFT-408. rb: Ruby C extension doesn't build on 1.8.5
This patch redefines the important macros so 1.8.5 is compatible.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@758517 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/rb/ext/macros.h b/lib/rb/ext/macros.h
index 6dbb7ad..8e1f343 100644
--- a/lib/rb/ext/macros.h
+++ b/lib/rb/ext/macros.h
@@ -26,4 +26,16 @@
#ifndef RFLOAT_VALUE
# define RFLOAT_VALUE(v) RFLOAT(rb_Float(v))->value
+#endif
+
+#ifndef RSTRING_LEN
+# define RSTRING_LEN(v) RSTRING(rb_String(v))->len
+#endif
+
+#ifndef RSTRING_PTR
+# define RSTRING_PTR(v) RSTRING(rb_String(v))->ptr
+#endif
+
+#ifndef RARRAY_LEN
+# define RARRAY_LEN(v) RARRAY(rb_Array(v))->len
#endif
\ No newline at end of file
diff --git a/lib/rb/ext/memory_buffer.c b/lib/rb/ext/memory_buffer.c
index e90de75..12dab31 100644
--- a/lib/rb/ext/memory_buffer.c
+++ b/lib/rb/ext/memory_buffer.c
@@ -19,6 +19,7 @@
#include <ruby.h>
#include <constants.h>
+#include "macros.h"
ID buf_ivar_id;
ID index_ivar_id;
diff --git a/lib/rb/ext/struct.c b/lib/rb/ext/struct.c
index 4947e26..8dd5c3e 100644
--- a/lib/rb/ext/struct.c
+++ b/lib/rb/ext/struct.c
@@ -19,6 +19,7 @@
#include <struct.h>
#include <constants.h>
+#include "macros.h"
#ifndef HAVE_STRLCPY