pkgsrc/textproc/hyperestraier/patches/patch-af
taca 34628602de * Add a patch to support both ruby18 and ruby19.
* Remove RUBY_HAS_ARCHLIB.

No functional change.
2010-09-10 08:25:16 +00:00

55 lines
1.7 KiB
Text

$NetBSD: patch-af,v 1.1 2010/09/10 08:25:17 taca Exp $
Use modern Ruby API.
--- rubynative/src/estraier.c.orig 2007-04-12 01:52:50.000000000 +0000
+++ rubynative/src/estraier.c
@@ -351,7 +351,7 @@ static VALUE doc_make_snippet(VALUE vsel
vdoc = rb_iv_get(vself, VNDATA);
Data_Get_Struct(vdoc, ESTDOC, doc);
Check_Type(vwords, T_ARRAY);
- len = RARRAY(vwords)->len;
+ len = RARRAY_LEN(vwords);
for(i = 0; i < len; i++){
Check_Type(rb_ary_entry(vwords, i), T_STRING);
}
@@ -764,7 +764,7 @@ static VALUE db_search_meta(VALUE vself,
CBMAP *hints;
int i, dnum, *res, rnum;
Check_Type(vdbs, T_ARRAY);
- dnum = RARRAY(vdbs)->len;
+ dnum = RARRAY_LEN(vdbs);
dbs = cbmalloc(dnum * sizeof(ESTMTDB *) + 1);
for(i = 0; i < dnum; i++){
vdb = rb_ary_entry(vdbs, i);
@@ -1189,10 +1189,10 @@ static CBLIST *objtocblist(VALUE obj){
VALUE str;
int i, len;
list = cblistopen();
- len = RARRAY(obj)->len;
+ len = RARRAY_LEN(obj);
for(i = 0; i < len; i++){
str = rb_ary_entry(obj, i);
- cblistpush(list, RSTRING(str)->ptr, RSTRING(str)->len);
+ cblistpush(list, RSTRING_PTR(str), RSTRING_LEN(str));
}
return list;
}
@@ -1218,14 +1218,14 @@ static CBMAP *objtocbmap(VALUE obj){
int i, len;
map = cbmapopenex(31);
keys = rb_funcall(obj, rb_intern("keys"), 0);
- len = RARRAY(keys)->len;
+ len = RARRAY_LEN(keys);
for(i = 0; i < len; i++){
key = rb_ary_entry(keys, i);
val = rb_hash_aref(obj, key);
key = rb_String(key);
val = rb_String(val);
- cbmapput(map, RSTRING(key)->ptr, RSTRING(key)->len,
- RSTRING(val)->ptr, RSTRING(val)->len, 0);
+ cbmapput(map, RSTRING_PTR(key), RSTRING_LEN(key),
+ RSTRING_PTR(val), RSTRING_LEN(val), 0);
}
return map;
}