--- ruby/caca-canvas.c.orig	2009-12-14 18:38:56.000000000 +0100
+++ ruby/caca-canvas.c	2012-02-29 12:11:26.911741071 +0100
@@ -274,7 +274,7 @@
     int error = 0;
     VALUE v, x, y;
 
-    n = RARRAY(points)->len;
+    n = RARRAY_LEN(points);
 
     ax = (int*)malloc(n*sizeof(int));
     if(!ax)
@@ -290,7 +290,7 @@
     for(i=0; i<n; i++)
     {
         v = rb_ary_entry(points, i);
-        if((TYPE(v) == T_ARRAY) && (RARRAY(v)->len == 2))
+        if((TYPE(v) == T_ARRAY) && (RARRAY_LEN(v) == 2))
         {
             x = rb_ary_entry(v,0);
             y = rb_ary_entry(v,1);
@@ -336,7 +336,7 @@
     int error = 0;
     VALUE v, x, y;
 
-    n = RARRAY(points)->len;
+    n = RARRAY_LEN(points);
 
     ax = (int*)malloc(n*sizeof(int));
     if(!ax)
@@ -352,7 +352,7 @@
     for(i=0; i<n; i++)
     {
         v = rb_ary_entry(points, i);
-        if((TYPE(v) == T_ARRAY) && (RARRAY(v)->len == 2))
+        if((TYPE(v) == T_ARRAY) && (RARRAY_LEN(v) == 2))
         {
             x = rb_ary_entry(v,0);
             y = rb_ary_entry(v,1);
@@ -459,7 +459,7 @@
     float cuv[6];
     VALUE v;
 
-    l = RARRAY(coords)->len;
+    l = RARRAY_LEN(coords);
     if(l != 6 && l != 3)
     {
         rb_raise(rb_eArgError, "invalid coords list");
@@ -471,14 +471,14 @@
             ccoords[i] = NUM2INT(v);
         else
         {
-            if((TYPE(v) != T_ARRAY) || (RARRAY(v)->len != 2))
+            if((TYPE(v) != T_ARRAY) || (RARRAY_LEN(v) != 2))
                 rb_raise(rb_eArgError, "invalid coords list");
             ccoords[2*i] = NUM2INT(rb_ary_entry(v, 0));
             ccoords[2*i+1] = NUM2INT(rb_ary_entry(v, 1));
         }
     }
 
-    l = RARRAY(uv)->len;
+    l = RARRAY_LEN(uv);
     if(l != 6 && l != 3)
     {
         rb_raise(rb_eArgError, "invalid uv list");
@@ -490,7 +490,7 @@
             cuv[i] = NUM2DBL(v);
         else
         {
-            if((TYPE(v) != T_ARRAY) || (RARRAY(v)->len != 2))
+            if((TYPE(v) != T_ARRAY) || (RARRAY_LEN(v) != 2))
                 rb_raise(rb_eArgError, "invalid uv list");
             ccoords[2*i] = NUM2DBL(rb_ary_entry(v, 0));
             ccoords[2*i+1] = NUM2DBL(rb_ary_entry(v, 1));
@@ -600,7 +600,7 @@
 static VALUE import_from_memory(VALUE self, VALUE data, VALUE format)
 {
     long int bytes;
-    bytes = caca_import_canvas_from_memory (_SELF, StringValuePtr(data), RSTRING(StringValue(data))->len, StringValuePtr(format));
+    bytes = caca_import_canvas_from_memory (_SELF, StringValuePtr(data), RSTRING_LEN(StringValue(data)), StringValuePtr(format));
     if(bytes <= 0)
         rb_raise(rb_eRuntimeError, strerror(errno));
 
@@ -610,7 +610,7 @@
 static VALUE import_area_from_memory(VALUE self, VALUE x, VALUE y, VALUE data, VALUE format)
 {
     long int bytes;
-    bytes = caca_import_area_from_memory (_SELF, NUM2INT(x), NUM2INT(y), StringValuePtr(data), RSTRING(StringValue(data))->len, StringValuePtr(format));
+    bytes = caca_import_area_from_memory (_SELF, NUM2INT(x), NUM2INT(y), StringValuePtr(data), RSTRING_LEN(StringValue(data)), StringValuePtr(format));
     if(bytes <= 0)
         rb_raise(rb_eRuntimeError, strerror(errno));
 
--- ruby/caca-dither.c.orig	2009-11-17 16:58:37.000000000 +0100
+++ ruby/caca-dither.c	2012-02-29 12:11:57.090640623 +0100
@@ -48,7 +48,7 @@
     VALUE v, r, g, b, a;
     int error = 0;
 
-    if(RARRAY(palette)->len != 256)
+    if(RARRAY_LEN(palette) != 256)
     {
         rb_raise(rb_eArgError, "Palette must contain 256 elements");
     }
@@ -84,7 +84,7 @@
     for(i=0; i<256; i++)
     {
         v = rb_ary_entry(palette, i);
-        if((TYPE(v) == T_ARRAY) && (RARRAY(v)->len == 4))
+        if((TYPE(v) == T_ARRAY) && (RARRAY_LEN(v) == 4))
         {
             r = rb_ary_entry(v,0);
             g = rb_ary_entry(v,1);
