summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-10-16 08:01:15 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-10-16 08:01:15 +0000
commitfc25bcd196e6e7c831004100c3789f49fcddb130 (patch)
tree7d23e05b1b4fabd921ee7a0218f65cb47e0ba87b
parent0172223fa10a0b1a2a016f5c79a1c5d819f636df (diff)
downloadruby-fc25bcd196e6e7c831004100c3789f49fcddb130.tar.gz
ruby-fc25bcd196e6e7c831004100c3789f49fcddb130.tar.xz
ruby-fc25bcd196e6e7c831004100c3789f49fcddb130.zip
* string.c (rb_str_upto): ("a"..."a").to_a should return [].
[ruby-core:01634] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@4785 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--string.c4
2 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 053f0a419..59bfaddc1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Oct 16 16:54:57 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_upto): ("a"..."a").to_a should return [].
+ [ruby-core:01634]
+
Thu Oct 16 16:40:51 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tk.rb:
diff --git a/string.c b/string.c
index ddf530c99..29c3cea63 100644
--- a/string.c
+++ b/string.c
@@ -1174,9 +1174,11 @@ rb_str_upto(beg, end, excl)
{
VALUE current, after_end;
ID succ = rb_intern("succ");
+ int n;
StringValue(end);
- if (rb_str_cmp(beg, end) > 0) return beg;
+ n = rb_str_cmp(beg, end);
+ if (n > 0 || (excl && n == 0)) return beg;
after_end = rb_funcall(end, succ, 0, 0);
current = beg;
while (!rb_str_equal(current, after_end)) {