openbsd-ports/textproc/ruby-hyperestraier/patches/patch-rubynative_src_estraier_c
jeremy fda7e2fba6 Add a ruby19 FLAVOR to build a ruby 1.9 version that can be installed
side by side with the default ruby 1.8 version.

OK landry@
2011-07-12 18:06:23 +00:00

53 lines
1.8 KiB
Plaintext

$OpenBSD: patch-rubynative_src_estraier_c,v 1.1 2011/07/12 18:06:23 jeremy Exp $
--- rubynative/src/estraier.c.orig Fri Jul 8 09:05:46 2011
+++ rubynative/src/estraier.c Fri Jul 8 09:08:29 2011
@@ -351,7 +351,7 @@ static VALUE doc_make_snippet(VALUE vself, VALUE vword
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, VALUE vdbs, V
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;
}