packages: ruby-ferret/ruby-ferret-ruby1.9.patch, ruby-ferret/ruby-ferret.sp...

atler atler at pld-linux.org
Thu Aug 12 18:34:14 CEST 2010


Author: atler                        Date: Thu Aug 12 16:34:14 2010 GMT
Module: packages                      Tag: HEAD
---- Log message:
- BR: ruby-devel
- updated patch for ruby 1.9 (from http://pennysmalls.com/2009/03/24/ferret-on-ruby-191/)

---- Files affected:
packages/ruby-ferret:
   ruby-ferret-ruby1.9.patch (1.1 -> 1.2) , ruby-ferret.spec (1.8 -> 1.9) 

---- Diffs:

================================================================
Index: packages/ruby-ferret/ruby-ferret-ruby1.9.patch
diff -u packages/ruby-ferret/ruby-ferret-ruby1.9.patch:1.1 packages/ruby-ferret/ruby-ferret-ruby1.9.patch:1.2
--- packages/ruby-ferret/ruby-ferret-ruby1.9.patch:1.1	Tue Mar  2 15:45:44 2010
+++ packages/ruby-ferret/ruby-ferret-ruby1.9.patch	Thu Aug 12 18:34:08 2010
@@ -1,13 +1,272 @@
---- ferret-0.11.6/ext/r_index.c~	2007-11-28 21:14:10.000000000 +0100
-+++ ferret-0.11.6/ext/r_index.c	2010-03-01 23:13:32.028394802 +0100
+diff -ur ferret-0.11.6/ext/ferret.c ferret-0.11.6-rb19/ext/ferret.c
+--- ferret-0.11.6/ext/ferret.c	2007-10-08 10:47:04.000000000 +0200
++++ ferret-0.11.6-rb19/ext/ferret.c	2010-08-12 16:36:28.000000000 +0200
+@@ -162,14 +162,14 @@
+ char *
+ rs2s(VALUE rstr)
+ {
+-    return (char *)(RSTRING(rstr)->ptr ? RSTRING(rstr)->ptr : EMPTY_STRING);
++    return (char *)(RSTRING_PTR(rstr) ? RSTRING_PTR(rstr) : EMPTY_STRING);
+ }
+ 
+ char *
+ nstrdup(VALUE rstr)
+ {
+     char *old = rs2s(rstr);
+-    int len = RSTRING(rstr)->len;
++    int len = RSTRING_LEN(rstr);
+     char *new = ALLOC_N(char, len + 1);
+     memcpy(new, old, len + 1);
+     return new;
+@@ -295,7 +295,7 @@
+     char *field = StringValuePtr(rfield);
+     char *text = StringValuePtr(rtext);
+     char *term_str = ALLOC_N(char,
+-                             5 + RSTRING(rfield)->len + RSTRING(rtext)->len);
++                             5 + RSTRING_LEN(rfield) + RSTRING_LEN(rtext));
+     sprintf(term_str, "%s:%s", field, text);
+     rstr = rb_str_new2(term_str);
+     free(term_str);
+diff -ur ferret-0.11.6/ext/lang.h ferret-0.11.6-rb19/ext/lang.h
+--- ferret-0.11.6/ext/lang.h	2007-11-28 23:09:27.000000000 +0100
++++ ferret-0.11.6-rb19/ext/lang.h	2010-08-12 16:36:28.000000000 +0200
+@@ -45,4 +45,22 @@
+ extern void V_FRT_EXIT(const char *err_type, const char *fmt, va_list args);
+ #endif
+ 
++#ifdef RUBY_RUBY_H
++#  define FRT_RUBY_VERSION_1_9
++#endif
++
++// ruby 1.8 compat with 1.9 to avoid ifdefs
++#if !defined RSTRING_LEN
++#define RSTRING_LEN(a) RSTRING(a)->len
++#endif
++#if !defined RSTRING_PTR
++#define RSTRING_PTR(a) RSTRING(a)->ptr
++#endif
++#if !defined RARRAY_LEN
++#define RARRAY_LEN(a) RARRAY(a)->len
++#endif
++#if !defined RARRAY_PTR
++#define RARRAY_PTR(a) RARRAY(a)->ptr
++#endif
++
+ #endif
+diff -ur ferret-0.11.6/ext/r_analysis.c ferret-0.11.6-rb19/ext/r_analysis.c
+--- ferret-0.11.6/ext/r_analysis.c	2007-10-09 02:44:32.000000000 +0200
++++ ferret-0.11.6-rb19/ext/r_analysis.c	2010-08-12 16:36:27.000000000 +0200
+@@ -1,6 +1,11 @@
+-#include <regex.h>
++#include "lang.h"
++#ifdef FRT_RUBY_VERSION_1_9
++#  include <ruby/re.h>
++#else
++#  include <regex.h>
++#endif
+ #include <locale.h>
+-#include <st.h>
++#include <ruby/st.h>
+ #include "ferret.h"
+ #include "analysis.h"
+ 
+@@ -47,13 +52,15 @@
+ 
+ static VALUE object_space;
+ 
++#ifndef FRT_RUBY_VERSION_1_9
+ extern int ruby_re_search(struct re_pattern_buffer *, const char *, int, int,
+                           int, struct re_registers *);
++#endif
+ 
+ int
+ frt_rb_hash_size(VALUE hash)
+ {
+-    return RHASH(hash)->tbl->num_entries;
++    return RHASH(hash)->ntbl->num_entries;
+ }
+ 
+ /****************************************************************************
+@@ -69,11 +76,11 @@
+     int i, len;
+     VALUE rstr;
+     Check_Type(rstop_words, T_ARRAY);
+-    len = RARRAY(rstop_words)->len;
+-    stop_words = ALLOC_N(char *, RARRAY(rstop_words)->len + 1);
++    len = RARRAY_LEN(rstop_words);
++    stop_words = ALLOC_N(char *, RARRAY_LEN(rstop_words) + 1);
+     stop_words[len] = NULL;
+     for (i = 0; i < len; i++) {
+-        rstr = rb_obj_as_string(RARRAY(rstop_words)->ptr[i]);
++        rstr = rb_obj_as_string(RARRAY_PTR(rstop_words)[i]);
+         stop_words[i] = rs2s(rstr);
+     }
+     return stop_words;
+@@ -132,7 +139,7 @@
+     if (rt == Qnil) return NULL;
+ 
+     Data_Get_Struct(rt, RToken, rtk);
+-    tk_set(tk, rs2s(rtk->text), RSTRING(rtk->text)->len,
++    tk_set(tk, rs2s(rtk->text), RSTRING_LEN(rtk->text),
+            rtk->start, rtk->end, rtk->pos_inc);
+     return tk;
+ }
+@@ -372,7 +379,7 @@
+     RToken *token;
+     char *buf;
+     GET_TK(token, self);
+-    buf = alloca(RSTRING(token->text)->len + 80);
++    buf = alloca(RSTRING_LEN(token->text) + 80);
+     sprintf(buf, "token[\"%s\":%d:%d:%d]", rs2s(token->text),
+             token->start, token->end, token->pos_inc);
+     return rb_str_new2(buf);
+@@ -621,7 +628,7 @@
+     VALUE rtext;
+     VALUE regex;
+     VALUE proc;
+-    int   curr_ind;  
++    long   curr_ind;
+ } RegExpTokenStream;
+ 
+ static void
+@@ -689,16 +696,82 @@
+     return RETS(ts)->rtext;
+ }
+ 
++#ifdef FRT_RUBY_VERSION_1_9
++
++// partly lifted from ruby 1.9 string.c
++#include <ruby/encoding.h>
++#define BEG(no) regs->beg[no]
++#define END(no) regs->end[no]
++#define STR_ENC_GET(str) rb_enc_from_index(ENCODING_GET(str))
++static VALUE
++  scan_once(VALUE str, VALUE pat, long *start)
++{
++  VALUE match;
++  struct re_registers *regs;
++
++  if (rb_reg_search(pat, str, *start, 0) >= 0) {
++    match = rb_backref_get();
++    regs = RMATCH_REGS(match);
++    if (BEG(0) == END(0)) {
++      rb_encoding *enc = STR_ENC_GET(str);
++      /*
++      * Always consume at least one character of the input string
++       */
++        if (RSTRING_LEN(str) > END(0))
++        *start = END(0)+rb_enc_mbclen(RSTRING_PTR(str)+END(0),
++        RSTRING_END(str), enc);
++      else
++        *start = END(0)+1;
++    }
++    else {
++      *start = END(0);
++    }
++    return rb_reg_nth_match(0, match);
++  }
++  return Qnil;
++}
++//
++
++static Token *
++  rets_next(TokenStream *ts)
++{
++  VALUE ret;
++  long rtok_len;
++  int beg, end;
++  Check_Type(RETS(ts)->regex, T_REGEXP);
++  ret = scan_once(RETS(ts)->rtext, RETS(ts)->regex, &(RETS(ts)->curr_ind));
++  if (NIL_P(ret)) return NULL;
++
++  Check_Type(ret, T_STRING);
++  rtok_len = RSTRING_LEN(ret);
++  beg = RETS(ts)->curr_ind - rtok_len;
++  end = RETS(ts)->curr_ind;
++
++  if (NIL_P(RETS(ts)->proc)) {
++    return tk_set(&(CachedTS(ts)->token), rs2s(ret), rtok_len,
++      beg, end, 1);
++  } else {
++    VALUE rtok;
++    rtok = rb_funcall(RETS(ts)->proc, id_call, 1, ret);
++    return tk_set(&(CachedTS(ts)->token), rs2s(rtok),
++      RSTRING_LEN(rtok), beg, end, 1);
++  }
++}
++
++#else
++
+ static Token *
+ rets_next(TokenStream *ts)
+ {
+     static struct re_registers regs;
+     int ret, beg, end;
+     struct RString *rtext = RSTRING(RETS(ts)->rtext);
++    long rtext_len = RSTRING_LEN(RETS(ts)->rtext);
++    char *rtext_ptr = RSTRING_PTR(RETS(ts)->rtext);
+     Check_Type(RETS(ts)->regex, T_REGEXP);
+     ret = ruby_re_search(RREGEXP(RETS(ts)->regex)->ptr,
+-                         rtext->ptr, rtext->len,
+-                         RETS(ts)->curr_ind, rtext->len - RETS(ts)->curr_ind,
++                         rtext_ptr, rtext_len,
++                         RETS(ts)->curr_ind, rtext_len - RETS(ts)->curr_ind,
+                          &regs);
+ 
+     if (ret == -2) rb_raise(rb_eStandardError, "regexp buffer overflow");
+@@ -707,16 +780,19 @@
+     beg = regs.beg[0];
+     RETS(ts)->curr_ind = end = regs.end[0];
+     if (NIL_P(RETS(ts)->proc)) {
+-        return tk_set(&(CachedTS(ts)->token), rtext->ptr + beg, end - beg,
++        return tk_set(&(CachedTS(ts)->token), rtext_ptr + beg, end - beg,
+                       beg, end, 1);
+     } else {
+-        VALUE rtok = rb_str_new(rtext->ptr + beg, end - beg);
++        VALUE rtok = rb_str_new(rtext_ptr + beg, end - beg);
+         rtok = rb_funcall(RETS(ts)->proc, id_call, 1, rtok);
+         return tk_set(&(CachedTS(ts)->token), rs2s(rtok),
+-                      RSTRING(rtok)->len, beg, end, 1);
++                      RSTRING_LEN(rtok), beg, end, 1);
+     }
+ }
+ 
++#endif
++
++
+ static TokenStream *
+ rets_reset(TokenStream *ts, char *text)
+ {
+@@ -1029,8 +1105,8 @@
+         }
+         if (TYPE(key) == T_ARRAY) {
+             int i;
+-            for (i = RARRAY(key)->len - 1; i >= 0; i--) {
+-                frt_add_mapping_i(mf, RARRAY(key)->ptr[i], to);
++            for (i = RARRAY_LEN(key) - 1; i >= 0; i--) {
++                frt_add_mapping_i(mf, RARRAY_PTR(key)[i], to);
+             }
+         }
+         else {
+diff -ur ferret-0.11.6/ext/r_index.c ferret-0.11.6-rb19/ext/r_index.c
+--- ferret-0.11.6/ext/r_index.c	2007-11-28 21:14:10.000000000 +0100
++++ ferret-0.11.6-rb19/ext/r_index.c	2010-08-12 16:36:28.000000000 +0200
+@@ -1,6 +1,6 @@
+ #include "ferret.h"
+ #include "index.h"
+-#include <st.h>
++#include <ruby/st.h>
+ 
+ VALUE mIndex;
+ 
 @@ -765,8 +765,8 @@
      char *term;
      int term_cnt = 0;
      VALUE vals = rb_ary_new2(2);
 -    RARRAY(vals)->len = 2;
 -    rb_mem_clear(RARRAY(vals)->ptr, 2);
-+    RARRAY_LEN(vals) = 2;
-+    rb_mem_clear(RARRAY_PTR(vals), 2);
++    rb_ary_store(vals, 0, Qnil);
++    rb_ary_store(vals, 1, Qnil);
  
  
      /* each is being called so there will be no current term */
@@ -28,8 +287,8 @@
      VALUE vals = rb_ary_new2(2);
 -    RARRAY(vals)->len = 2;
 -    rb_mem_clear(RARRAY(vals)->ptr, 2);
-+    RARRAY_LEN(vals) = 2;
-+    rb_mem_clear(RARRAY_PTR(vals), 2);
++    rb_ary_store(vals, 0, Qnil);
++    rb_ary_store(vals, 1, Qnil);
  
      while (tde->next(tde)) {
          doc_cnt++;
@@ -40,46 +299,52 @@
          rb_yield(vals);
  
      }
-@@ -1215,11 +1215,11 @@
-         VALUE *rpos;
+@@ -1212,14 +1212,11 @@
+     VALUE rpositions = Qnil;
+     rtext = rb_str_new2(tv_term->text);
+     if (tv_term->positions) {
+-        VALUE *rpos;
          int *positions = tv_term->positions;
          rpositions = rb_ary_new2(freq);
 -        rpos = RARRAY(rpositions)->ptr;
-+        rpos = RARRAY_PTR(rpositions);
          for (i = 0; i < freq; i++) {
-             rpos[i] = INT2FIX(positions[i]);
+-            rpos[i] = INT2FIX(positions[i]);
++	  rb_ary_store(rpositions, i, INT2FIX(positions[i]));
          }
 -        RARRAY(rpositions)->len = freq;
-+        RARRAY_LEN(rpositions) = freq;
      }
      return rb_struct_new(cTVTerm, rtext, rpositions, NULL);
  }
-@@ -1242,20 +1242,20 @@
+@@ -1237,25 +1234,20 @@
+     TVTerm *terms = tv->terms;
+     const int t_cnt = tv->term_cnt;
+     const int o_cnt = tv->offset_cnt;
+-    VALUE rfield, rterms, *rts;
++    VALUE rfield, rterms;
+     VALUE roffsets = Qnil;
      rfield = ID2SYM(rb_intern(tv->field));
  
      rterms = rb_ary_new2(t_cnt);
 -    rts = RARRAY(rterms)->ptr;
-+    rts = RARRAY_PTR(rterms);
      for (i = 0; i < t_cnt; i++) {
-         rts[i] = frt_get_tv_term(&terms[i]);
+-        rts[i] = frt_get_tv_term(&terms[i]);
 -        RARRAY(rterms)->len++;
-+        RARRAY_LEN(rterms)++;
++      rb_ary_store(rterms, i, frt_get_tv_term(&terms[i]));
      }
  
      if (tv->offsets) {
-         VALUE *ros;
+-        VALUE *ros;
          Offset *offsets = tv->offsets;
          roffsets = rb_ary_new2(o_cnt);
 -        ros = RARRAY(roffsets)->ptr;
-+        ros = RARRAY_PTR(roffsets);
          for (i = 0; i < o_cnt; i++) {
-             ros[i] = frt_get_tv_offsets(&offsets[i]);
+-            ros[i] = frt_get_tv_offsets(&offsets[i]);
 -            RARRAY(roffsets)->len++;
-+            RARRAY_LEN(roffsets)++;
++	  rb_ary_store(roffsets, i, frt_get_tv_offsets(&offsets[i]));
          }
      }
  
-@@ -1458,19 +1458,19 @@
+@@ -1458,19 +1450,19 @@
                  {
                      int i;
                      df->destroy_data = true;
@@ -104,7 +369,7 @@
                  break;
          }
          doc_add_field(doc, df);
-@@ -1498,9 +1498,9 @@
+@@ -1498,9 +1490,9 @@
                  int i;
                  df = df_new("content");
                  df->destroy_data = true;
@@ -117,7 +382,7 @@
                  }
                  doc_add_field(doc, df);
              }
-@@ -1511,13 +1511,13 @@
+@@ -1511,13 +1503,13 @@
              break;
          case T_STRING:
              df = df_add_data_len(df_new("content"), rs2s(rdoc),
@@ -133,7 +398,7 @@
              df->destroy_data = true;
              doc_add_field(doc, df);
              break;
-@@ -1597,14 +1597,14 @@
+@@ -1597,14 +1589,14 @@
      IndexReader **irs;
      Check_Type(rreaders, T_ARRAY);
  
@@ -152,30 +417,28 @@
      free(irs);
      return self;
  }
-@@ -1953,9 +1953,9 @@
+@@ -1953,9 +1945,7 @@
              rdata = rb_ary_new2(lazy_df->size);
              for (i = 0; i < lazy_df->size; i++) {
                  char *data = lazy_df_get_data(lazy_df, i);
 -                RARRAY(rdata)->ptr[i] =
-+                RARRAY_PTR(rdata)[i] =
-                     rb_str_new(data, lazy_df->data[i].length);
+-                    rb_str_new(data, lazy_df->data[i].length);
 -                RARRAY(rdata)->len++;
-+                RARRAY_LEN(rdata)++;
++		rb_ary_store(rdata, i, rb_str_new(data, lazy_df->data[i].length));
              }
          }
          rb_hash_aset(self, rkey, rdata);
-@@ -2038,8 +2038,8 @@
+@@ -2038,8 +2028,7 @@
      rb_ivar_set(self, id_data, rdata);
  
      for (i = 0; i < lazy_doc->size; i++) {
 -        RARRAY(rfields)->ptr[i] = ID2SYM(rb_intern(lazy_doc->fields[i]->name));
 -        RARRAY(rfields)->len++;
-+        RARRAY_PTR(rfields)[i] = ID2SYM(rb_intern(lazy_doc->fields[i]->name));
-+        RARRAY_LEN(rfields)++;
++      rb_ary_store(rfields, i, ID2SYM(rb_intern(lazy_doc->fields[i]->name)));
      }
      rb_ivar_set(self, id_fields, rfields);
  
-@@ -2115,11 +2115,11 @@
+@@ -2115,11 +2104,11 @@
  
      if (TYPE(rdir) == T_ARRAY) {
          VALUE rdirs = rdir;
@@ -189,13 +452,14 @@
              switch (TYPE(rdir)) {
                  case T_DATA:
                      if (CLASS_OF(rdir) == cIndexReader) {
-@@ -2235,11 +2235,11 @@
+@@ -2235,11 +2224,11 @@
      int offset;
      offset = FIX2INT(roffset);
      Check_Type(rnorms, T_STRING);
 -    if (RSTRING(rnorms)->len < offset + ir->max_doc(ir)) {
+-        rb_raise(rb_eArgError, "supplied a string of length:%d to "
 +    if (RSTRING_LEN(rnorms) < offset + ir->max_doc(ir)) {
-         rb_raise(rb_eArgError, "supplied a string of length:%d to "
++        rb_raise(rb_eArgError, "supplied a string of length:%ld to "
                   "IndexReader#get_norms_into but needed a string of length "
                   "offset:%d + maxdoc:%d",
 -                 RSTRING(rnorms)->len, offset, ir->max_doc(ir));
@@ -203,158 +467,56 @@
      }
  
      ir_get_norms_into(ir, frt_field(rfield),
-@@ -2382,8 +2382,8 @@
+@@ -2382,8 +2371,7 @@
      len = max - pos;
      ary = rb_ary_new2(len);
      for (i = 0; i < len; i++) {
 -        RARRAY(ary)->ptr[i] = frt_get_lazy_doc(ir->get_lazy_doc(ir, i + pos));
 -        RARRAY(ary)->len++;
-+        RARRAY_PTR(ary)[i] = frt_get_lazy_doc(ir->get_lazy_doc(ir, i + pos));
-+        RARRAY_LEN(ary)++;
++      rb_ary_store(ary, i, frt_get_lazy_doc(ir->get_lazy_doc(ir, i + pos)));
      }
      return ary;
  }
---- ferret-0.11.6/ext/r_analysis.c.orig	2007-10-09 02:44:32.000000000 +0200
-+++ ferret-0.11.6/ext/r_analysis.c	2010-03-02 15:37:06.422124836 +0100
-@@ -1,6 +1,6 @@
--#include <regex.h>
- #include <locale.h>
--#include <st.h>
-+#include <ruby/st.h>
-+#include <ruby/regex.h>
- #include "ferret.h"
- #include "analysis.h"
- 
-@@ -53,7 +53,7 @@
- int
- frt_rb_hash_size(VALUE hash)
- {
--    return RHASH(hash)->tbl->num_entries;
-+    return RHASH_SIZE(hash);
- }
- 
- /****************************************************************************
-@@ -69,11 +69,11 @@
-     int i, len;
-     VALUE rstr;
-     Check_Type(rstop_words, T_ARRAY);
--    len = RARRAY(rstop_words)->len;
--    stop_words = ALLOC_N(char *, RARRAY(rstop_words)->len + 1);
-+    len = RARRAY_LEN(rstop_words);
-+    stop_words = ALLOC_N(char *, RARRAY_LEN(rstop_words) + 1);
-     stop_words[len] = NULL;
-     for (i = 0; i < len; i++) {
--        rstr = rb_obj_as_string(RARRAY(rstop_words)->ptr[i]);
-+        rstr = rb_obj_as_string(RARRAY_PTR(rstop_words)[i]);
-         stop_words[i] = rs2s(rstr);
-     }
-     return stop_words;
-@@ -132,7 +132,7 @@
-     if (rt == Qnil) return NULL;
- 
-     Data_Get_Struct(rt, RToken, rtk);
--    tk_set(tk, rs2s(rtk->text), RSTRING(rtk->text)->len,
-+    tk_set(tk, rs2s(rtk->text), RSTRING_LEN(rtk->text),
-            rtk->start, rtk->end, rtk->pos_inc);
-     return tk;
- }
-@@ -372,7 +372,7 @@
-     RToken *token;
-     char *buf;
-     GET_TK(token, self);
--    buf = alloca(RSTRING(token->text)->len + 80);
-+    buf = alloca(RSTRING_LEN(token->text) + 80);
-     sprintf(buf, "token[\"%s\":%d:%d:%d]", rs2s(token->text),
-             token->start, token->end, token->pos_inc);
-     return rb_str_new2(buf);
-@@ -697,8 +697,8 @@
-     struct RString *rtext = RSTRING(RETS(ts)->rtext);
-     Check_Type(RETS(ts)->regex, T_REGEXP);
-     ret = ruby_re_search(RREGEXP(RETS(ts)->regex)->ptr,
--                         rtext->ptr, rtext->len,
--                         RETS(ts)->curr_ind, rtext->len - RETS(ts)->curr_ind,
-+                         RSTRING_PTR(rtext), RSTRING_LEN(rtext),
-+                         RETS(ts)->curr_ind, RSTRING_LEN(rtext) - RETS(ts)->curr_ind,
-                          &regs);
- 
-     if (ret == -2) rb_raise(rb_eStandardError, "regexp buffer overflow");
-@@ -707,13 +707,13 @@
-     beg = regs.beg[0];
-     RETS(ts)->curr_ind = end = regs.end[0];
-     if (NIL_P(RETS(ts)->proc)) {
--        return tk_set(&(CachedTS(ts)->token), rtext->ptr + beg, end - beg,
-+        return tk_set(&(CachedTS(ts)->token), RSTRING_PTR(rtext) + beg, end - beg,
-                       beg, end, 1);
-     } else {
--        VALUE rtok = rb_str_new(rtext->ptr + beg, end - beg);
-+        VALUE rtok = rb_str_new(RSTRING_PTR(rtext) + beg, end - beg);
-         rtok = rb_funcall(RETS(ts)->proc, id_call, 1, rtok);
-         return tk_set(&(CachedTS(ts)->token), rs2s(rtok),
--                      RSTRING(rtok)->len, beg, end, 1);
-+                      RSTRING_LEN(rtok), beg, end, 1);
-     }
- }
- 
-@@ -1029,8 +1029,8 @@
-         }
-         if (TYPE(key) == T_ARRAY) {
-             int i;
--            for (i = RARRAY(key)->len - 1; i >= 0; i--) {
--                frt_add_mapping_i(mf, RARRAY(key)->ptr[i], to);
-+            for (i = RARRAY_LEN(key) - 1; i >= 0; i--) {
-+                frt_add_mapping_i(mf, RARRAY_PTR(key)[i], to);
+@@ -2410,9 +2398,8 @@
+             pos = FIX2INT(arg1);
+             pos = (pos < 0) ? (max + pos) : pos;
+             if (pos < 0 || pos >= max) {
+-                rb_raise(rb_eArgError, ":%d is out of range [%d..%d] for "
+-                         "IndexReader#[]", pos, 0, max,
+-                         rb_id2name(SYM2ID(argv)));
++                rb_raise(rb_eArgError, ":%ld is out of range [%d..%ld] for "
++                         "IndexReader#[]", pos, 0, max);
              }
+             return frt_get_lazy_doc(ir->get_lazy_doc(ir, pos));
          }
-         else {
---- ferret-0.11.6/ext/ferret.c~	2007-10-08 10:47:04.000000000 +0200
-+++ ferret-0.11.6/ext/ferret.c	2010-03-02 15:38:31.451322502 +0100
-@@ -162,14 +162,14 @@
- char *
- rs2s(VALUE rstr)
- {
--    return (char *)(RSTRING(rstr)->ptr ? RSTRING(rstr)->ptr : EMPTY_STRING);
-+    return (char *)(RSTRING_PTR(rstr) ? RSTRING_PTR(rstr) : EMPTY_STRING);
- }
- 
- char *
- nstrdup(VALUE rstr)
- {
-     char *old = rs2s(rstr);
--    int len = RSTRING(rstr)->len;
-+    int len = RSTRING_LEN(rstr);
-     char *new = ALLOC_N(char, len + 1);
-     memcpy(new, old, len + 1);
-     return new;
-@@ -295,7 +295,7 @@
-     char *field = StringValuePtr(rfield);
-     char *text = StringValuePtr(rtext);
-     char *term_str = ALLOC_N(char,
--                             5 + RSTRING(rfield)->len + RSTRING(rtext)->len);
-+                             5 + RSTRING_LEN(rfield) + RSTRING_LEN(rtext));
-     sprintf(term_str, "%s:%s", field, text);
-     rstr = rb_str_new2(term_str);
-     free(term_str);
---- ferret-0.11.6/ext/r_search.c~	2007-11-24 00:26:33.000000000 +0100
-+++ ferret-0.11.6/ext/r_search.c	2010-03-02 15:40:02.774187117 +0100
-@@ -1,5 +1,5 @@
- #include "ferret.h"
--#include <st.h>
-+#include <ruby/st.h>
- #include <rubysig.h>
- #include <ctype.h>
- #include <array.h>
<<Diff was trimmed, longer than 597 lines>>

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/ruby-ferret/ruby-ferret-ruby1.9.patch?r1=1.1&r2=1.2&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/ruby-ferret/ruby-ferret.spec?r1=1.8&r2=1.9&f=u



More information about the pld-cvs-commit mailing list