diff options
author | Simon Howard | 2014-03-30 18:07:52 -0400 |
---|---|---|
committer | Simon Howard | 2014-03-30 18:09:07 -0400 |
commit | 71d8ef248f4f1a05646f5e1e7e6388a59f08b121 (patch) | |
tree | 27aa543016b37eec74e99b49d309f235f6ecdc29 /src/m_misc.c | |
parent | 724c4ad7a4f2a541eff157d9196b3835eb4bc8d8 (diff) | |
download | chocolate-doom-71d8ef248f4f1a05646f5e1e7e6388a59f08b121.tar.gz chocolate-doom-71d8ef248f4f1a05646f5e1e7e6388a59f08b121.tar.bz2 chocolate-doom-71d8ef248f4f1a05646f5e1e7e6388a59f08b121.zip |
Eliminate some uses of sprintf() from common code.
As part of this, add DIR_SEPARATOR_S as a string version of the
DIR_SEPARATOR macro. Change M_TempFile() to return a string allocated
on the C heap rather than the zone heap.
This is a first step towards fixing #371.
Diffstat (limited to 'src/m_misc.c')
-rw-r--r-- | src/m_misc.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/m_misc.c b/src/m_misc.c index d48a82e5..15daee3b 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -174,7 +174,6 @@ int M_ReadFile(char *name, byte **buffer) char *M_TempFile(char *s) { - char *result; char *tempdir; #ifdef _WIN32 @@ -193,10 +192,7 @@ char *M_TempFile(char *s) tempdir = "/tmp"; #endif - result = Z_Malloc(strlen(tempdir) + strlen(s) + 2, PU_STATIC, 0); - sprintf(result, "%s%c%s", tempdir, DIR_SEPARATOR, s); - - return result; + return M_StringJoin(tempdir, DIR_SEPARATOR_S, s, NULL); } boolean M_StrToInt(const char *str, int *result) |