THRIFT-408. rb: Ruby C extension doesn't build on 1.8.5
authorBryan Duxbury <bryanduxbury@apache.org>
Thu, 26 Mar 2009 04:55:34 +0000 (04:55 +0000)
committerBryan Duxbury <bryanduxbury@apache.org>
Thu, 26 Mar 2009 04:55:34 +0000 (04:55 +0000)
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

lib/rb/ext/macros.h
lib/rb/ext/memory_buffer.c
lib/rb/ext/struct.c

index 6dbb7ad..8e1f343 100644 (file)
 
 #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
index e90de75..12dab31 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <ruby.h>
 #include <constants.h>
+#include "macros.h"
 
 ID buf_ivar_id;
 ID index_ivar_id;
index 4947e26..8dd5c3e 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <struct.h>
 #include <constants.h>
+#include "macros.h"
 
 #ifndef HAVE_STRLCPY