--- utf8proc/ruby/utf8proc_native.c	2007-07-22 03:33:49.000000000 -0400
+++ utf/ruby/utf8proc_native.c	2008-04-14 05:03:03.000000000 -0400
@@ -34,6 +34,11 @@
 #include "../utf8proc.c"
 #include "ruby.h"
 
+#ifndef RSTRING_PTR
+# define RSTRING_PTR(s) (RSTRING(s)->ptr)
+# define RSTRING_LEN(s) (RSTRING(s)->len)
+#endif
+
 typedef struct utf8proc_ruby_mapenv_struct {
   int32_t *buffer;
 } utf8proc_ruby_mapenv_t;
@@ -79,14 +84,14 @@
   options = NUM2INT(options_param) & ~UTF8PROC_NULLTERM;
   env_obj = Data_Make_Struct(rb_cObject, utf8proc_ruby_mapenv_t, NULL,
     utf8proc_ruby_mapenv_free, env);
-  result = utf8proc_decompose(RSTRING(str)->ptr, RSTRING(str)->len,
+  result = utf8proc_decompose(RSTRING_PTR(str), RSTRING_LEN(str),
     NULL, 0, options);
   if (result < 0) {
     utf8proc_ruby_map_error(result);
     return Qnil;  // needed to prevent problems with optimization
   }
   env->buffer = ALLOC_N(int32_t, result+1);
-  result = utf8proc_decompose(RSTRING(str)->ptr, RSTRING(str)->len,
+  result = utf8proc_decompose(RSTRING_PTR(str), RSTRING_LEN(str),
     env->buffer, result, options);
   if (result < 0) {
     free(env->buffer);

