Commit 7ebf1554 authored by Sebastian Ramacher's avatar Sebastian Ramacher
Browse files

Use strrchr in file_get_extension


Signed-off-by: Sebastian Ramacher's avatarSebastian Ramacher <sebastian+dev@ramacher.at>
parent 5bc7c721
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment