FS_Dir_f little optimisation.

This commit is contained in:
David Carlier 2024-11-02 14:05:47 +00:00
parent 19a119417c
commit 1b7ceada59
No known key found for this signature in database
GPG key ID: 8486F847B4B94EF1

View file

@ -1534,6 +1534,7 @@ FS_Dir_f(void)
char **dirnames; /* File list. */ char **dirnames; /* File list. */
char findname[1024]; /* File search path and pattern. */ char findname[1024]; /* File search path and pattern. */
char *path = NULL; /* Search path. */ char *path = NULL; /* Search path. */
char *lastsep;
char wildcard[1024] = "*.*"; /* File pattern. */ char wildcard[1024] = "*.*"; /* File pattern. */
int i; /* Loop counter. */ int i; /* Loop counter. */
int ndirs; /* Number of files in list. */ int ndirs; /* Number of files in list. */
@ -1555,9 +1556,10 @@ FS_Dir_f(void)
{ {
for (i = 0; i < ndirs - 1; i++) for (i = 0; i < ndirs - 1; i++)
{ {
if (strrchr(dirnames[i], '/')) lastsep = strrchr(dirnames[i], '/');
if (lastsep)
{ {
Com_Printf("%s\n", strrchr(dirnames[i], '/') + 1); Com_Printf("%s\n", lastsep + 1);
} }
else else
{ {