diff options
author | Eric Wong <normalperson@yhbt.net> | 2011-01-31 09:10:09 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-01-31 09:10:09 +0000 |
commit | ea0455e966a95f7a4be0c8f4b9c0481f0392ff39 (patch) | |
tree | 0147f7ada42bf61767aa739b344cf98143ea2234 | |
parent | 480219900f3d47c7b9ddf830a1e19b4aa39e83e2 (diff) | |
download | mahoro-ea0455e966a95f7a4be0c8f4b9c0481f0392ff39.tar.gz |
update for Ruby 1.9 compatibility
RSTRING(str)->len no longer works in Ruby 1.9 due to internal data representation changes for performance.
-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)); } |