From: Ian Macdonald Date: 2003-11-13T17:58:08+09:00 Subject: Re: problems with rb_str_split() On Wed 12 Nov 2003 at 20:02:33 +0900, ts wrote: > >>>>> "I" == Ian Macdonald writes: > > I> This worked fine in Ruby 1.6.x, but in 1.8.x, it generates a warning in > I> any code that invokes the method: > > Well, I don't have this problem with 1.8.1 > > nasun% cat aa.c > #include > > void Init_aa() > { > VALUE res; > const char *comma_sp = ", "; > int i; > > res = rb_str_split(rb_str_new2("abc, def"), ", "); > for (i = 0; i < RARRAY(res)->len; i++) { > rb_warn("found %s", StringValuePtr(RARRAY(res)->ptr[i])); > } > } > nasun% > > nasun% ruby -raa -ve 1 > ruby 1.8.1 (2003-10-31) [sparc-solaris2.8] > ./aa.so: warning: found abc > ./aa.so: warning: found def > -e:1: warning: useless use of a literal in void context > nasun% Try running it with warnings enabled (-w): [ianmacd@jiskefet]$ ruby -raa -wve 1 ruby 1.8.0 (2003-08-04) [i686-linux-gnu] ./aa.so: warning: string pattern instead of regexp; metacharacters no longer effective ./aa.so: warning: found abc ./aa.so: warning: found def -e:1: warning: useless use of a literal in void context So, how do I get rid of the "string pattern instead of regexp" warning? Ian -- Ian Macdonald | A is for Apple. -- Hester Pryne System Administrator | ian@caliban.org | http://www.caliban.org | |