summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--string.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 3fbe5dcd9..582ee4c62 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Thu Feb 7 15:42:42 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * string.c (rb_str_end_with): compares with the suffix.
+
Thu Feb 7 15:03:15 2008 NARUSE, Yui <naruse@ruby-lang.org>
* enc/trans/korean.c: add support for CP949 by Park Ji-In.
diff --git a/string.c b/string.c
index 945241ca3..db6b19e68 100644
--- a/string.c
+++ b/string.c
@@ -5663,7 +5663,7 @@ rb_str_end_with(int argc, VALUE *argv, VALUE str)
s = p + RSTRING_LEN(str) - RSTRING_LEN(tmp);
if (rb_enc_left_char_head(p, s, enc) != s)
continue;
- if (memcmp(s, p, RSTRING_LEN(tmp)) == 0)
+ if (memcmp(s, RSTRING_PTR(tmp), RSTRING_LEN(tmp)) == 0)
return Qtrue;
}
return Qfalse;