Skip to content

Commit

Permalink
Merge pull request yquake2#1162 from devnexen/cmdparser_optim
Browse files Browse the repository at this point in the history
cmdparser/server command little optimisations.
  • Loading branch information
Yamagi authored Nov 23, 2024
2 parents b64ae0e + d73f94d commit 8b9f506
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/common/cmdparser.c
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ Cmd_CompleteMapCommand(char *partial)
{
char **mapNames;
int i, j, k, nbMatches, len, nMaps;
char *mapName;
char *mapName, *lastsep;
char *pmatch[1024];
qboolean partialFillContinue = true;

Expand All @@ -920,9 +920,9 @@ Cmd_CompleteMapCommand(char *partial)

for (i = 0; i < nMaps - 1; i++)
{
if (strrchr(mapNames[i], '/'))
if ((lastsep = strrchr(mapNames[i], '/')))
{
mapName = strrchr(mapNames[i], '/') + 1;
mapName = lastsep + 1;
}
else
{
Expand Down
6 changes: 3 additions & 3 deletions src/server/sv_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,17 +317,17 @@ void SV_ListMaps_f(void)
char **userMapNames;
int nUserMaps = 0;
int i;
char* mapName;
char* mapName, *lastsep;

Com_Printf("\n");

if ((userMapNames = FS_ListFiles2("maps/*.bsp", &nUserMaps, 0, 0)) != NULL)
{
for (i = 0; i < nUserMaps - 1; i++)
{
if (strrchr(userMapNames[i], '/'))
if ((lastsep = strrchr(userMapNames[i], '/')))
{
mapName = strrchr(userMapNames[i], '/') + 1;
mapName = lastsep + 1;
}
else
{
Expand Down

0 comments on commit 8b9f506

Please sign in to comment.