mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* file.c (rmext): preceding dots are not a part of extension.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
655685612e
commit
9320b5c65f
2 changed files with 9 additions and 2 deletions
|
@ -1,3 +1,7 @@
|
|||
Sat Sep 27 03:57:19 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* file.c (rmext): preceding dots are not a part of extension.
|
||||
|
||||
Sat Sep 27 03:15:51 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* vm.c (vm_jump_tag_but_local_jump): exc is not used if val is nil.
|
||||
|
|
7
file.c
7
file.c
|
@ -2955,16 +2955,19 @@ rb_file_s_absolute_path(int argc, VALUE *argv)
|
|||
static int
|
||||
rmext(const char *p, int l1, const char *e)
|
||||
{
|
||||
int l2;
|
||||
int l0, 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;
|
||||
e = p + l1;
|
||||
do {
|
||||
if (e <= p) return 0;
|
||||
if (e <= p + l0) return 0;
|
||||
} while (*--e != c);
|
||||
return e - p;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue