This commit is contained in:
Vitor Santos Costa 2017-10-02 16:04:34 +01:00
parent 9f1ef65ff5
commit d05b1f4b2b

View File

@ -76,15 +76,14 @@ static Int file_name_extension(USES_REGS1) {
pop_text_stack(l); pop_text_stack(l);
return false; return false;
} }
size_t len_b = strlen(f), lenb_b, lene_b; size_t len_b = strlen(f), lenb_b;
char *candidate = strrchr(f, '.'); char *candidate = strrchr(f, '.');
char *file = strrchr(f, '/'); char *file = strrchr(f, '/');
if (candidate && file && candidate > file) { if (candidate && file && candidate > file) {
lenb_b = candidate - f, lene_b = (f + len_b) - (candidate + 1); lenb_b = candidate - f;
ext = candidate + 1; ext = candidate + 1;
} else { } else {
lenb_b = len_b; lenb_b = len_b;
lene_b = 0;
ext = ""; ext = "";
} }
base = Malloc(lenb_b + 1); base = Malloc(lenb_b + 1);
@ -98,7 +97,7 @@ static Int file_name_extension(USES_REGS1) {
#if __APPLE__ || _WIN32 #if __APPLE__ || _WIN32
rc = strcasecmp(f_a, base) == 0; rc = strcasecmp(f_a, base) == 0;
#else #else
rc = strcmp(f_a, base) == 0 rc = strcmp(f_a, base) == 0;
#endif #endif
} }
if (rc) { if (rc) {
@ -113,7 +112,7 @@ static Int file_name_extension(USES_REGS1) {
#if __APPLE__ || _WIN32 #if __APPLE__ || _WIN32
rc = strcasecmp(f_a, ext) == 0; rc = strcasecmp(f_a, ext) == 0;
#else #else
rc = strcmp(f_a, ext) == 0 rc = strcmp(f_a, ext) == 0;
#endif #endif
} }
} }