Skip to content

Commit 9cbcdb2

Browse files
committed
linux: refactor some delimiter repaces
1 parent 1c77f0b commit 9cbcdb2

File tree

3 files changed

+3
-16
lines changed

3 files changed

+3
-16
lines changed

src/xrCore/LocatorAPI.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -434,11 +434,7 @@ void CLocatorAPI::LoadArchive(archive& A, pcstr entrypoint)
434434

435435
strconcat(sizeof full, full, fs_entry_point, name);
436436
#if defined(LINUX)
437-
char *tmp_ptr = strchr(full, '\\');
438-
while (tmp_ptr) {
439-
*tmp_ptr = '/';
440-
tmp_ptr = strchr(tmp_ptr, '\\');
441-
}
437+
while (char* sep = strchr(full, '\\')) *sep = '/';
442438
#endif
443439
Register(full, A.vfs_idx, crc, ptr, size_real, size_compr, 0);
444440
}

src/xrCore/LocatorAPI_defs.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,7 @@ FS_Path::FS_Path(LPCSTR _Root, LPCSTR _Add, LPCSTR _DefExt, LPCSTR _FilterCaptio
4848
if (_Add)
4949
xr_strcat(temp, _Add);
5050
#if defined(LINUX)
51-
char *ptr = strchr(temp, '\\');
52-
while (ptr) {
53-
*ptr = _DELIMITER;
54-
ptr = strchr(ptr, '\\');
55-
}
51+
while (char* sep = strchr(temp, '\\')) *sep = '/';
5652
#endif
5753
if (temp[0] && temp[xr_strlen(temp) - 1] != _DELIMITER)
5854
xr_strcat(temp, DELIMITER);

src/xrEngine/GameFont.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,7 @@ void CGameFont::Initialize(pcstr cShader, pcstr cTextureName)
6060
xr_strcpy(cTexture, sizeof(cTexture), cTextureName);
6161

6262
#if defined(LINUX)
63-
char* ptr = strchr(cTexture, '\\');
64-
while (ptr)
65-
{
66-
*ptr = '/';
67-
ptr = strchr(ptr, '\\');
68-
}
63+
while (char* sep = strchr(cTexture, '\\')) *sep = '/';
6964
#endif
7065

7166
uFlags &= ~fsValid;

0 commit comments

Comments
 (0)