commit 4ae3076411ebed9439a9eee3ec75d92a1b230813
Author: Simon Howard <fraggle@soulsphere.org>
AuthorDate: Sun Oct 28 19:05:52 2018 -0400
Commit: Simon Howard <fraggle@soulsphere.org>
CommitDate: Sun Oct 28 19:05:52 2018 -0400
Use M_StringJoin() instead of hand-rolled malloc.
---
src/d_iwad.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/src/d_iwad.c b/src/d_iwad.c
index 8ae0faac..cda32b91 100644
--- a/src/d_iwad.c
+++ b/src/d_iwad.c
@@ -385,8 +385,7 @@ static void CheckSteamGUSPatches(void)
{
const char *current_path;
char *install_path;
- char *patch_path;
- int len;
+ char *test_patch_path, patch_path;
// Already configured? Don't stomp on the user's choices.
current_path = M_GetStringVariable("gus_patch_path");
@@ -402,19 +401,17 @@ static void CheckSteamGUSPatches(void)
return;
}
- len = strlen(install_path) + strlen(STEAM_BFG_GUS_PATCHES) + 20;
- patch_path = malloc(len);
- M_snprintf(patch_path, len, "%s\\%s\\ACBASS.PAT",
- install_path, STEAM_BFG_GUS_PATCHES);
+ patch_path = M_StringJoin(install_path, "\\", STEAM_BFG_GUS_PATCHES,
+ NULL);
+ test_patch_path = M_StringJoin(patch_path, "\\ACBASS.PAT", NULL);
// Does acbass.pat exist? If so, then set gus_patch_path.
- if (M_FileExists(patch_path))
+ if (M_FileExists(test_patch_path))
{
- M_snprintf(patch_path, len, "%s\\%s",
- install_path, STEAM_BFG_GUS_PATCHES);
M_SetVariable("gus_patch_path", patch_path);
}
+ free(test_patch_path);
free(patch_path);
free(install_path);
}