utf8proc
changeset 11:d79da2302625
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)
- Use RSTRING_PTR() and RSTRING_LEN() instead of RSTRING()->ptr and RSTRING()->len for ruby1.9 compatibility (and #define them, if not existent)
author | jbe |
---|---|
date | Thu Aug 20 12:00:00 2009 +0200 (2009-08-20) |
parents | 00d2bcbdc945 |
children | 82d33620bb8a |
files | ruby/utf8proc_native.c |
line diff
1.1 --- a/ruby/utf8proc_native.c Wed Aug 19 12:00:00 2009 +0200 1.2 +++ b/ruby/utf8proc_native.c Thu Aug 20 12:00:00 2009 +0200 1.3 @@ -32,6 +32,13 @@ 1.4 #include "../utf8proc.c" 1.5 #include "ruby.h" 1.6 1.7 +#ifndef RSTRING_PTR 1.8 +#define RSTRING_PTR(s) (RSTRING(s)->ptr) 1.9 +#endif 1.10 +#ifndef RSTRING_LEN 1.11 +#define RSTRING_LEN(s) (RSTRING(s)->len) 1.12 +#endif 1.13 + 1.14 typedef struct utf8proc_ruby_mapenv_struct { 1.15 int32_t *buffer; 1.16 } utf8proc_ruby_mapenv_t; 1.17 @@ -77,14 +84,14 @@ 1.18 options = NUM2INT(options_param) & ~UTF8PROC_NULLTERM; 1.19 env_obj = Data_Make_Struct(rb_cObject, utf8proc_ruby_mapenv_t, NULL, 1.20 utf8proc_ruby_mapenv_free, env); 1.21 - result = utf8proc_decompose(RSTRING(str)->ptr, RSTRING(str)->len, 1.22 + result = utf8proc_decompose(RSTRING_PTR(str), RSTRING_LEN(str), 1.23 NULL, 0, options); 1.24 if (result < 0) { 1.25 utf8proc_ruby_map_error(result); 1.26 return Qnil; /* needed to prevent problems with optimization */ 1.27 } 1.28 env->buffer = ALLOC_N(int32_t, result+1); 1.29 - result = utf8proc_decompose(RSTRING(str)->ptr, RSTRING(str)->len, 1.30 + result = utf8proc_decompose(RSTRING_PTR(str), RSTRING_LEN(str), 1.31 env->buffer, result, options); 1.32 if (result < 0) { 1.33 free(env->buffer);