From e59f770ccbf61f012d148a390e7f76775ab2a02e Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Sun, 9 Feb 2014 16:12:59 +0100 Subject: Revert "Merge pull request #49 from Parlane/sprintf_tidy" Change broke the build on Debian stable. This reverts commit 28755439b36ac8e875d764da5db31ad693459ace, reversing changes made to 64e01ec763d21915e7166e625f8a3e85b46fbcbb. --- Source/Core/Common/MemArena.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'Source/Core/Common/MemArena.cpp') diff --git a/Source/Core/Common/MemArena.cpp b/Source/Core/Common/MemArena.cpp index 699005dd52..e7f3911e91 100644 --- a/Source/Core/Common/MemArena.cpp +++ b/Source/Core/Common/MemArena.cpp @@ -6,7 +6,6 @@ #include "MemoryUtil.h" #include "MemArena.h" -#include "StringUtil.h" #ifdef _WIN32 #include @@ -58,21 +57,20 @@ void MemArena::GrabLowMemSpace(size_t size) return; } #else + char fn[64]; for (int i = 0; i < 10000; i++) { - std::string file_name = StringFromFormat("dolphinmem.%d", i); - fd = shm_open(file_name.c_str(), O_RDWR | O_CREAT | O_EXCL, 0600); + sprintf(fn, "dolphinmem.%d", i); + fd = shm_open(fn, O_RDWR | O_CREAT | O_EXCL, 0600); if (fd != -1) - { - shm_unlink(file_name.c_str()); break; - } - else if (errno != EEXIST) + if (errno != EEXIST) { ERROR_LOG(MEMMAP, "shm_open failed: %s", strerror(errno)); return; } } + shm_unlink(fn); if (ftruncate(fd, size) < 0) ERROR_LOG(MEMMAP, "Failed to allocate low memory space"); #endif -- cgit v1.2.3