From 4c70f05fe0d2ba706c8c24da1d2149f79551ce9f Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 30 Apr 2017 03:04:50 -0400 Subject: [PATCH] MemoryWindow: Get rid of unnecessary std::string constructions std::string's operator+ will handle this. Also move std::string to where they're actually needed. There's no need to construct an unnecessary string if the first failure case occurs. --- Source/Core/DolphinWX/Debugger/MemoryWindow.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp index f1f3b06772..3422f2c2ef 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp @@ -176,17 +176,16 @@ void CMemoryWindow::OnSetMemoryValue(wxCommandEvent& event) } std::string str_addr = WxStrToStr(m_address_search_ctrl->GetValue()); - std::string str_val = WxStrToStr(m_value_text_ctrl->GetValue()); u32 addr; - u32 val; - - if (!TryParse(std::string("0x") + str_addr, &addr)) + if (!TryParse("0x" + str_addr, &addr)) { WxUtils::ShowErrorDialog(wxString::Format(_("Invalid address: %s"), str_addr.c_str())); return; } - if (!TryParse(std::string("0x") + str_val, &val)) + std::string str_val = WxStrToStr(m_value_text_ctrl->GetValue()); + u32 val; + if (!TryParse("0x" + str_val, &val)) { WxUtils::ShowErrorDialog(wxString::Format(_("Invalid value: %s"), str_val.c_str())); return;