diff options
| author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-07-24 07:19:34 +0000 |
|---|---|---|
| committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-07-24 07:19:34 +0000 |
| commit | 90b3fa398f328fba7e13fbea2edbb3e6fa7a9241 (patch) | |
| tree | 7d0763676e49c49f8b06b2a74042d7530f71a1e0 | |
| parent | b8331e2167d928a11f46b30c6c0dabe6cd362573 (diff) | |
| download | ruby-90b3fa398f328fba7e13fbea2edbb3e6fa7a9241.tar.gz ruby-90b3fa398f328fba7e13fbea2edbb3e6fa7a9241.tar.xz ruby-90b3fa398f328fba7e13fbea2edbb3e6fa7a9241.zip | |
matz
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 4 | ||||
| -rw-r--r-- | ext/md5/md5init.c | 1 | ||||
| -rw-r--r-- | string.c | 4 |
3 files changed, 9 insertions, 0 deletions
@@ -1,3 +1,7 @@ +Sun Jul 23 12:55:04 2000 Dave Thomas <Dave@Thomases.com> + + * string.c (rb_str_rindex): Support negative end position. + Fri Jul 21 17:35:01 2000 Yukihiro Matsumoto <matz@netlab.co.jp> * parse.y (aref_args): command_call now be permitted as diff --git a/ext/md5/md5init.c b/ext/md5/md5init.c index f3dafed33..a57d5f8f3 100644 --- a/ext/md5/md5init.c +++ b/ext/md5/md5init.c @@ -105,6 +105,7 @@ Init_md5() cMD5 = rb_define_class("MD5", rb_cObject); rb_define_singleton_method(cMD5, "new", md5_new, -1); + rb_define_singleton_method(cMD5, "md5", md5_new, -1); rb_define_method(cMD5, "update", md5_update, 1); rb_define_method(cMD5, "digest", md5_digest, 0); @@ -684,6 +684,10 @@ rb_str_rindex(argc, argv, str) if (rb_scan_args(argc, argv, "11", &sub, &position) == 2) { pos = NUM2INT(position); + if (pos < 0) { + pos += RSTRING(str)->len; + if (pos < 0) return Qnil; + } if (pos > RSTRING(str)->len) pos = RSTRING(str)->len; } else { |
