* 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
@ -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>
|
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.
|
* 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
|
static int
|
||||||
rmext(const char *p, int l1, const char *e)
|
rmext(const char *p, int l1, const char *e)
|
||||||
{
|
{
|
||||||
int l2;
|
int l0, l2;
|
||||||
|
|
||||||
if (!e) return 0;
|
if (!e) return 0;
|
||||||
|
|
||||||
|
for (l0 = 0; l0 < l1; ++l0) {
|
||||||
|
if (p[l0] != '.') break;
|
||||||
|
}
|
||||||
l2 = strlen(e);
|
l2 = strlen(e);
|
||||||
if (l2 == 2 && e[1] == '*') {
|
if (l2 == 2 && e[1] == '*') {
|
||||||
unsigned char c = *e;
|
unsigned char c = *e;
|
||||||
e = p + l1;
|
e = p + l1;
|
||||||
do {
|
do {
|
||||||
if (e <= p) return 0;
|
if (e <= p + l0) return 0;
|
||||||
} while (*--e != c);
|
} while (*--e != c);
|
||||||
return e - p;
|
return e - p;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user