summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--include/ruby/intern.h2
-rw-r--r--re.c11
-rw-r--r--string.c12
4 files changed, 13 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index c17fb85513..dfb82b2f24 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,3 @@
-Thu Oct 4 18:23:28 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * re.c (rb_memcmp): no longer useful without ruby_ignorecase.
-
- * re.c (rb_reg_prepare_re): revert recompile condition.
-
Thu Oct 4 17:33:18 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* re.c (kcode_setter): Perl-ish global variable `$=' no longer
diff --git a/include/ruby/intern.h b/include/ruby/intern.h
index 2684076a12..500ec6a358 100644
--- a/include/ruby/intern.h
+++ b/include/ruby/intern.h
@@ -442,7 +442,7 @@ VALUE rb_range_beg_len(VALUE, long*, long*, long, int);
unsigned long genrand_int32(void);
double genrand_real(void);
/* re.c */
-#define rb_memcmp(a,b,c) memcmp(a,b,c)
+int rb_memcmp(const void*,const void*,long);
int rb_memcicmp(const void*,const void*,long);
long rb_memsearch(const void*,long,const void*,long);
VALUE rb_reg_nth_defined(int, VALUE);
diff --git a/re.c b/re.c
index d58fbbfb80..053526de09 100644
--- a/re.c
+++ b/re.c
@@ -91,6 +91,12 @@ rb_memcicmp(const void *x, const void *y, long len)
return 0;
}
+int
+rb_memcmp(const void *p1, const void *p2, long len)
+{
+ return rb_memcicmp(p1, p2, len);
+}
+
long
rb_memsearch(const void *x0, long m, const void *y0, long n)
{
@@ -897,11 +903,6 @@ rb_reg_prepare_re(VALUE re)
RBASIC(re)->flags |= reg_kcode;
}
- if (state) {
- FL_UNSET(re, REG_CASESTATE);
- RREGEXP(re)->ptr->options &= ~ONIG_OPTION_IGNORECASE;
- need_recompile = 1;
- }
if (need_recompile) {
onig_errmsg_buffer err;
int r;
diff --git a/string.c b/string.c
index 72f5b97a3e..67ea574015 100644
--- a/string.c
+++ b/string.c
@@ -1226,7 +1226,7 @@ rb_str_cmp(VALUE str1, VALUE str2)
rb_enc_check(str1, str2); /* xxxx error-less encoding check? */
len = lesser(RSTRING_LEN(str1), RSTRING_LEN(str2));
- retval = memcmp(RSTRING_PTR(str1), RSTRING_PTR(str2), len);
+ retval = rb_memcmp(RSTRING_PTR(str1), RSTRING_PTR(str2), len);
if (retval == 0) {
if (RSTRING_LEN(str1) == RSTRING_LEN(str2)) return 0;
if (RSTRING_LEN(str1) > RSTRING_LEN(str2)) return 1;
@@ -1485,7 +1485,7 @@ rb_str_rindex(VALUE str, VALUE sub, long pos)
t = RSTRING_PTR(sub);
for (;;) {
s = str_nth(sbeg, e, pos, enc);
- if (memcmp(s, t, slen) == 0) {
+ if (rb_memcmp(s, t, slen) == 0) {
return pos;
}
if (pos == 0) break;
@@ -4090,7 +4090,7 @@ rb_str_each_line(int argc, VALUE *argv, VALUE str)
p -= n;
}
if (c == newline &&
- (rslen <= 1 || memcmp(RSTRING_PTR(rs), p, rslen) == 0)) {
+ (rslen <= 1 || rb_memcmp(RSTRING_PTR(rs), p, rslen) == 0)) {
line = rb_str_new5(str, s, p - s + (rslen ? rslen : n));
OBJ_INFECT(line, str);
rb_yield(line);
@@ -4325,7 +4325,7 @@ rb_str_chomp_bang(int argc, VALUE *argv, VALUE str)
if (p[len-1] == newline &&
(rslen <= 1 ||
- memcmp(RSTRING_PTR(rs), p+len-rslen, rslen) == 0)) {
+ rb_memcmp(RSTRING_PTR(rs), p+len-rslen, rslen) == 0)) {
rb_str_modify(str);
STR_SET_LEN(str, RSTRING_LEN(str) - rslen);
RSTRING_PTR(str)[RSTRING_LEN(str)] = '\0';
@@ -5064,7 +5064,7 @@ rb_str_start_with(int argc, VALUE *argv, VALUE str)
if (NIL_P(tmp)) continue;
rb_enc_check(str, tmp);
if (RSTRING_LEN(str) < RSTRING_LEN(tmp)) continue;
- if (memcmp(RSTRING_PTR(str), RSTRING_PTR(tmp), RSTRING_LEN(tmp)) == 0)
+ if (rb_memcmp(RSTRING_PTR(str), RSTRING_PTR(tmp), RSTRING_LEN(tmp)) == 0)
return Qtrue;
}
return Qfalse;
@@ -5087,7 +5087,7 @@ rb_str_end_with(int argc, VALUE *argv, VALUE str)
if (NIL_P(tmp)) continue;
rb_enc_check(str, tmp);
if (RSTRING_LEN(str) < RSTRING_LEN(tmp)) continue;
- if (memcmp(RSTRING_PTR(str) + RSTRING_LEN(str) - RSTRING_LEN(tmp),
+ if (rb_memcmp(RSTRING_PTR(str) + RSTRING_LEN(str) - RSTRING_LEN(tmp),
RSTRING_PTR(tmp), RSTRING_LEN(tmp)) == 0)
return Qtrue;
}