diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-07-28 20:52:16 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-07-28 20:52:16 +0000 |
commit | b67ecc80df8502e10ddce0ceaeb7b5dfb5f8fba4 (patch) | |
tree | d19f5fc40dcc8c01ae2e10a3f4de9f2d567b5f92 /file.c | |
parent | 793af6993f90c80250c6d4be6829ca5b88b9d885 (diff) |
* file.c (rb_file_s_basename): pass baselen to rmext.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -3398,15 +3398,12 @@ rb_file_s_realdirpath(int argc, VALUE *argv, VALUE klass) } static size_t -rmext(const char *p, long l1, const char *e) +rmext(const char *p, long l0, long l1, const char *e) { - long l0, l2; + long l2; if (!e) return 0; - for (l0 = 0; l0 < l1; ++l0) { - if (p[l0] != '.') break; - } l2 = strlen(e); if (l2 == 2 && e[1] == '*') { unsigned char c = *e; @@ -3527,7 +3524,7 @@ rb_file_s_basename(int argc, VALUE *argv) p = ruby_find_basename(name, &f, &n); if (n >= 0) { - if (NIL_P(fext) || !(f = rmext(p, n, StringValueCStr(fext)))) { + if (NIL_P(fext) || !(f = rmext(p, f, n, StringValueCStr(fext)))) { f = n; } if (f == RSTRING_LEN(fname)) return rb_str_new_shared(fname); |