mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-11-10 20:23:49 +01:00
Use strrchr in file_get_extension
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
parent
5bc7c7212d
commit
7ebf15543b
16
utils.c
16
utils.c
@ -29,24 +29,16 @@
|
||||
const char*
|
||||
file_get_extension(const char* path)
|
||||
{
|
||||
if (!path) {
|
||||
if (path == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
unsigned int i = strlen(path);
|
||||
for (; i > 0; i--) {
|
||||
if (*(path + i) != '.') {
|
||||
continue;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!i) {
|
||||
const char* res = strrchr(path, '.');
|
||||
if (res == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return path + i + 1;
|
||||
return res + 1;
|
||||
}
|
||||
|
||||
bool
|
||||
|
Loading…
Reference in New Issue
Block a user