From 3bf88110aa9a39f530680b4f72bca29be0637e5b Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Mon, 24 Dec 2012 20:55:35 -0800 Subject: [PATCH] Removal of more lingering wcs2str() --- fallback.cpp | 7 +++---- wutil.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/fallback.cpp b/fallback.cpp index 69348db1e..b52a6330c 100644 --- a/fallback.cpp +++ b/fallback.cpp @@ -276,6 +276,7 @@ static int vgwprintf(void (*writer)(wchar_t), { wchar_t *ss=0; + wcstring wide_ss; if (is_long) { ss = va_arg(va, wchar_t *); @@ -286,7 +287,8 @@ static int vgwprintf(void (*writer)(wchar_t), if (ns) { - ss = str2wcs(ns); + wide_ss = str2wcstring(ns); + ss = wide_ss.c_str(); } } @@ -319,9 +321,6 @@ static int vgwprintf(void (*writer)(wchar_t), count += maxi(width-wcslen(ss), 0); } - if (!is_long) - free(ss); - break; } diff --git a/wutil.cpp b/wutil.cpp index 978b7e0a8..8d9b2f4d9 100644 --- a/wutil.cpp +++ b/wutil.cpp @@ -330,16 +330,16 @@ wchar_t *wrealpath(const wcstring &pathname, wchar_t *resolved_path) if (!narrow_res) return 0; - + + const wcstring wide_res = str2wcstring(narrow_res); if (resolved_path) { - wcstring tmp2 = str2wcstring(narrow_res); - wcslcpy(resolved_path, tmp2.c_str(), PATH_MAX); + wcslcpy(resolved_path, wide_res.c_str(), PATH_MAX); res = resolved_path; } else { - res = wcsdup(str2wcstring(narrow_res).c_str()); + res = wcsdup(wide_res.c_str()); } return res; }