Skip to content
This repository was archived by the owner on May 16, 2020. It is now read-only.

Commit 4c3c646

Browse files
committed
qcommon: use strrchr in COM_SkipPath
1 parent 13326e2 commit 4c3c646

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/qcommon/q_shared.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,16 @@ void COM_FixPath(char *pathname)
8181
*/
8282
char *COM_SkipPath(char *pathname)
8383
{
84-
char *last = pathname;
84+
char *last = strrchr(pathname, '/');
8585

86-
while (*pathname)
86+
if (last)
8787
{
88-
if (*pathname == '/')
89-
{
90-
last = pathname + 1;
91-
}
92-
pathname++;
88+
return last + 1;
89+
}
90+
else
91+
{
92+
return pathname;
9393
}
94-
return last;
9594
}
9695

9796
/**

0 commit comments

Comments
 (0)