# HG changeset patch # User jbe # Date 1250762400 -7200 # Node ID d79da2302625a3ca8e8fbe7f1b59e540462eb273 # Parent 00d2bcbdc9455d023b03a96346436ec34914a392 Changes for Ruby 1.9 compatibility - Use RSTRING_PTR() and RSTRING_LEN() instead of RSTRING()->ptr and RSTRING()->len for ruby1.9 compatibility (and #define them, if not existent) diff -r 00d2bcbdc945 -r d79da2302625 ruby/utf8proc_native.c --- a/ruby/utf8proc_native.c Wed Aug 19 12:00:00 2009 +0200 +++ b/ruby/utf8proc_native.c Thu Aug 20 12:00:00 2009 +0200 @@ -32,6 +32,13 @@ #include "../utf8proc.c" #include "ruby.h" +#ifndef RSTRING_PTR +#define RSTRING_PTR(s) (RSTRING(s)->ptr) +#endif +#ifndef RSTRING_LEN +#define RSTRING_LEN(s) (RSTRING(s)->len) +#endif + typedef struct utf8proc_ruby_mapenv_struct { int32_t *buffer; } utf8proc_ruby_mapenv_t; @@ -77,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);