about summary refs log tree commit homepage
path: root/mahoro.c
diff options
context:
space:
mode:
Diffstat (limited to 'mahoro.c')
-rw-r--r--mahoro.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/mahoro.c b/mahoro.c
index 3fd1e61..4b125b0 100644
--- a/mahoro.c
+++ b/mahoro.c
@@ -8,6 +8,9 @@
 #ifndef RSTRING_LEN
 #  define RSTRING_LEN(s)->len
 #endif
+#ifndef RSTRING_PTR
+#  define RSTRING_PTR(s)->ptr
+#endif
 
 struct MagicCookie
 {
@@ -91,8 +94,10 @@ mahoro_buffer(self, input)
         const char *msg;
         magic_t cookie = ((struct MagicCookie *) DATA_PTR(self))->cookie;
 
-        if(!(msg = magic_buffer(cookie, StringValuePtr(input),
-                                        RSTRING_LEN(StringValue(input))))) {
+        StringValue(input);
+
+        if(!(msg = magic_buffer(cookie, RSTRING_PTR(input),
+                                        RSTRING_LEN(input)))) {
                 rb_raise(eMahoroError, "failed lookup: %s", magic_error(cookie));
         }