From b8c9d149b1a80cc46d57cda00c85f28aa82e5def Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Sun, 6 Sep 2009 05:41:41 +0200 Subject: [PATCH] do not allocate mem for s in ToString on heap since it has const size --- src/window.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/window.cpp b/src/window.cpp index 110a1b2d..b8629c9a 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -866,14 +866,13 @@ Window * Window::EmptyClone() const std::string ToString(const std::wstring &ws) { std::string result; - char *s = new char[MB_CUR_MAX]; + char s[MB_CUR_MAX]; for (size_t i = 0; i < ws.length(); ++i) { int n = wcrtomb(s, ws[i], 0); if (n > 0) result.append(s, n); } - delete [] s; return result; }