diff options
| author | Markus Wick <markus+github@selfnet.de> | 2015-01-28 13:23:32 +0100 |
|---|---|---|
| committer | Markus Wick <markus+github@selfnet.de> | 2015-01-28 13:23:32 +0100 |
| commit | 109fa8c2c8c90aac5a45fbe58190766efe383959 (patch) | |
| tree | 6de6c8c5da98806632e1bfb8fe4a84141a91bc62 /Source/Core/Common/StringUtil.cpp | |
| parent | eedc7bb5823157defa8f76e45df02c410f88e23e (diff) | |
| parent | c3777bbd691353f3f3eecfaecb518a52b6a0a1ea (diff) | |
Merge pull request #1800 from randomstuff/jit-register
Add support of more JIT-compiled code for profiling
Diffstat (limited to 'Source/Core/Common/StringUtil.cpp')
| -rw-r--r-- | Source/Core/Common/StringUtil.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/Source/Core/Common/StringUtil.cpp b/Source/Core/Common/StringUtil.cpp index cfd7b03577..b922704032 100644 --- a/Source/Core/Common/StringUtil.cpp +++ b/Source/Core/Common/StringUtil.cpp @@ -95,28 +95,30 @@ bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list ar std::string StringFromFormat(const char* format, ...) { va_list args; + va_start(args, format); + std::string res = StringFromFormatV(format, args); + va_end(args); + return std::move(res); +} + +std::string StringFromFormatV(const char* format, va_list args) +{ char *buf = nullptr; #ifdef _WIN32 - int required = 0; - - va_start(args, format); - required = _vscprintf(format, args); + int required = _vscprintf(format, args); buf = new char[required + 1]; CharArrayFromFormatV(buf, required + 1, format, args); - va_end(args); std::string temp = buf; delete[] buf; #else - va_start(args, format); if (vasprintf(&buf, format, args) < 0) ERROR_LOG(COMMON, "Unable to allocate memory for string"); - va_end(args); std::string temp = buf; free(buf); #endif - return temp; + return std::move(temp); } // For Debugging. Read out an u8 array. |
