diff options
-rw-r--r-- | mahoro.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -5,6 +5,10 @@ #include <ruby.h> #include <magic.h> +#ifndef RSTRING_LEN +# define RSTRING_LEN(s)->len +#endif + struct MagicCookie { magic_t cookie; @@ -88,7 +92,7 @@ mahoro_buffer(self, input) magic_t cookie = ((struct MagicCookie *) DATA_PTR(self))->cookie; if(!(msg = magic_buffer(cookie, StringValuePtr(input), - RSTRING(StringValue(input))->len))) { + RSTRING_LEN(StringValue(input))))) { rb_raise(eMahoroError, "failed lookup: %s", magic_error(cookie)); } |