From c110ffcdaa8b928a984a89cebacd03f5caaace06 Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Sat, 2 Mar 2019 19:42:25 +0100 Subject: [PATCH] Remove redundant initialization --- Source/Core/AudioCommon/PulseAudioStream.cpp | 4 +--- Source/Core/Common/GekkoDisassembler.cpp | 4 ++-- Source/Core/Common/Profiler.cpp | 2 +- Source/Core/Core/Debugger/Debugger_SymbolMap.cpp | 2 +- Source/Core/Core/HW/WiimoteReal/IOLinux.cpp | 2 +- Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp | 2 ++ Source/Core/Core/HW/WiimoteReal/WiimoteReal.h | 6 +++--- Source/Core/Core/Movie.cpp | 4 ++-- Source/Core/Core/PowerPC/Interpreter/Interpreter.cpp | 4 ++-- Source/Core/UICommon/Disassembler.cpp | 4 ++-- Source/Core/UICommon/UICommon.cpp | 2 +- Source/Core/VideoBackends/Null/Render.cpp | 2 +- Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp | 4 ++-- Source/Core/VideoBackends/Software/SWRenderer.cpp | 2 +- Source/Core/VideoCommon/PostProcessing.cpp | 2 +- Source/Core/VideoCommon/TextureCacheBase.cpp | 2 +- Source/UnitTests/Common/StringUtilTest.cpp | 2 +- 17 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Source/Core/AudioCommon/PulseAudioStream.cpp b/Source/Core/AudioCommon/PulseAudioStream.cpp index 05d08b1603..e480ed9e6e 100644 --- a/Source/Core/AudioCommon/PulseAudioStream.cpp +++ b/Source/Core/AudioCommon/PulseAudioStream.cpp @@ -15,9 +15,7 @@ namespace const size_t BUFFER_SAMPLES = 512; // ~10 ms - needs to be at least 240 for surround } -PulseAudio::PulseAudio() : m_thread(), m_run_thread() -{ -} +PulseAudio::PulseAudio() = default; bool PulseAudio::Init() { diff --git a/Source/Core/Common/GekkoDisassembler.cpp b/Source/Core/Common/GekkoDisassembler.cpp index 345694738f..acf5e9f9a4 100644 --- a/Source/Core/Common/GekkoDisassembler.cpp +++ b/Source/Core/Common/GekkoDisassembler.cpp @@ -118,8 +118,8 @@ static const char* regnames[32] = {"r0", "sp", "rtoc", "r3", "r4", "r5", "r // Initialize static class variables. u32* GekkoDisassembler::m_instr = nullptr; u32* GekkoDisassembler::m_iaddr = nullptr; -std::string GekkoDisassembler::m_opcode = ""; -std::string GekkoDisassembler::m_operands = ""; +std::string GekkoDisassembler::m_opcode; +std::string GekkoDisassembler::m_operands; unsigned char GekkoDisassembler::m_type = 0; unsigned char GekkoDisassembler::m_flags = PPCF_ILLEGAL; unsigned short GekkoDisassembler::m_sreg = 0; diff --git a/Source/Core/Common/Profiler.cpp b/Source/Core/Common/Profiler.cpp index 0be14073bd..ab575b9d86 100644 --- a/Source/Core/Common/Profiler.cpp +++ b/Source/Core/Common/Profiler.cpp @@ -25,7 +25,7 @@ u32 Profiler::s_max_length = 0; u64 Profiler::s_frame_time; u64 Profiler::s_usecs_frame; -std::string Profiler::s_lazy_result = ""; +std::string Profiler::s_lazy_result; int Profiler::s_lazy_delay = 0; Profiler::Profiler(const std::string& name) diff --git a/Source/Core/Core/Debugger/Debugger_SymbolMap.cpp b/Source/Core/Core/Debugger/Debugger_SymbolMap.cpp index cc281d52ea..b76427e36a 100644 --- a/Source/Core/Core/Debugger/Debugger_SymbolMap.cpp +++ b/Source/Core/Core/Debugger/Debugger_SymbolMap.cpp @@ -147,7 +147,7 @@ void PrintDataBuffer(LogTypes::LOG_TYPE type, const u8* data, size_t size, const GENERIC_LOG(type, LogTypes::LDEBUG, "%s", title.c_str()); for (u32 j = 0; j < size;) { - std::string hex_line = ""; + std::string hex_line; for (int i = 0; i < 16; i++) { hex_line += StringFromFormat("%02x ", data[j++]); diff --git a/Source/Core/Core/HW/WiimoteReal/IOLinux.cpp b/Source/Core/Core/HW/WiimoteReal/IOLinux.cpp index 06aa932211..141c6c4bbe 100644 --- a/Source/Core/Core/HW/WiimoteReal/IOLinux.cpp +++ b/Source/Core/Core/HW/WiimoteReal/IOLinux.cpp @@ -106,7 +106,7 @@ void WiimoteScannerLinux::FindWiimotes(std::vector& found_wiimotes, Wi } } -WiimoteLinux::WiimoteLinux(bdaddr_t bdaddr) : Wiimote(), m_bdaddr(bdaddr) +WiimoteLinux::WiimoteLinux(bdaddr_t bdaddr) : m_bdaddr(bdaddr) { m_really_disconnect = true; diff --git a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp index 3f61902a92..a23752b792 100644 --- a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp @@ -52,6 +52,8 @@ std::mutex g_wiimotes_mutex; std::unique_ptr g_wiimotes[MAX_BBMOTES]; WiimoteScanner g_wiimote_scanner; +Wiimote::Wiimote() = default; + void Wiimote::Shutdown() { std::lock_guard lk(s_known_ids_mutex); diff --git a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.h b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.h index e5673eaf78..c951f86049 100644 --- a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.h +++ b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.h @@ -1,4 +1,4 @@ -// Copyright 2008 Dolphin Emulator Project +// Copyright 2008 Dolphin Emulator Project // Licensed under GPLv2+ // Refer to the license.txt file included. @@ -113,10 +113,10 @@ public: int GetIndex() const; protected: - Wiimote() = default; + Wiimote(); int m_index = 0; - Report m_last_input_report = {}; + Report m_last_input_report; u16 m_channel = 0; // If true, the Wiimote will be really disconnected when it is disconnected by Dolphin. diff --git a/Source/Core/Core/Movie.cpp b/Source/Core/Core/Movie.cpp index 93cc595eb6..2e209c47b2 100644 --- a/Source/Core/Core/Movie.cpp +++ b/Source/Core/Core/Movie.cpp @@ -92,8 +92,8 @@ static bool s_bSaveConfig = false, s_bNetPlay = false; static bool s_bClearSave = false; static bool s_bDiscChange = false; static bool s_bReset = false; -static std::string s_author = ""; -static std::string s_discChange = ""; +static std::string s_author; +static std::string s_discChange; static std::array s_MD5; static u8 s_bongos, s_memcards; static std::array s_revision; diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter.cpp index 14602f7b00..f4e5959a89 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter.cpp @@ -116,13 +116,13 @@ static int startTrace = 0; static void Trace(UGeckoInstruction& inst) { - std::string regs = ""; + std::string regs; for (int i = 0; i < 32; i++) { regs += StringFromFormat("r%02d: %08x ", i, PowerPC::ppcState.gpr[i]); } - std::string fregs = ""; + std::string fregs; for (int i = 0; i < 32; i++) { const auto& ps = PowerPC::ppcState.ps[i]; diff --git a/Source/Core/UICommon/Disassembler.cpp b/Source/Core/UICommon/Disassembler.cpp index d8f74b0cf3..56898d90e4 100644 --- a/Source/Core/UICommon/Disassembler.cpp +++ b/Source/Core/UICommon/Disassembler.cpp @@ -83,7 +83,7 @@ std::string HostDisassemblerLLVM::DisassembleHostBlock(const u8* code_start, con { // If we are on an architecture that has a fixed instruction size // We can continue onward past this bad instruction. - std::string inst_str = ""; + std::string inst_str; for (int i = 0; i < m_instruction_size; ++i) inst_str += StringFromFormat("%02x", disasmPtr[i]); @@ -94,7 +94,7 @@ std::string HostDisassemblerLLVM::DisassembleHostBlock(const u8* code_start, con { // We can't continue if we are on an architecture that has flexible instruction sizes // Dump the rest of the block instead - std::string code_block = ""; + std::string code_block; for (int i = 0; (disasmPtr + i) < end; ++i) code_block += StringFromFormat("%02x", disasmPtr[i]); diff --git a/Source/Core/UICommon/UICommon.cpp b/Source/Core/UICommon/UICommon.cpp index 3b6eb4ff52..f460f09f2a 100644 --- a/Source/Core/UICommon/UICommon.cpp +++ b/Source/Core/UICommon/UICommon.cpp @@ -194,7 +194,7 @@ void SetUserDirectory(const std::string& custom_path) return; } - std::string user_path = ""; + std::string user_path; #ifdef _WIN32 // Detect where the User directory is. There are five different cases // (on top of the command line flag, which overrides all this): diff --git a/Source/Core/VideoBackends/Null/Render.cpp b/Source/Core/VideoBackends/Null/Render.cpp index ca57a0bdeb..f77eefe782 100644 --- a/Source/Core/VideoBackends/Null/Render.cpp +++ b/Source/Core/VideoBackends/Null/Render.cpp @@ -66,7 +66,7 @@ std::unique_ptr Renderer::CreateShaderFromBinary(ShaderStage sta class NullPipeline final : public AbstractPipeline { public: - NullPipeline() : AbstractPipeline() {} + NullPipeline() = default; ~NullPipeline() override = default; }; diff --git a/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp b/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp index 61cd953b69..6f2fc6dd9a 100644 --- a/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp +++ b/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp @@ -51,7 +51,7 @@ static int num_failures = 0; static GLuint CurrentProgram = 0; ProgramShaderCache::PipelineProgramMap ProgramShaderCache::s_pipeline_programs; std::mutex ProgramShaderCache::s_pipeline_program_lock; -static std::string s_glsl_header = ""; +static std::string s_glsl_header; static std::atomic s_shader_counter{0}; static thread_local bool s_is_shared_context = false; @@ -684,7 +684,7 @@ void ProgramShaderCache::CreateHeader() break; } - std::string earlyz_string = ""; + std::string earlyz_string; if (g_ActiveConfig.backend_info.bSupportsEarlyZ) { if (g_ogl_config.bSupportsImageLoadStore) diff --git a/Source/Core/VideoBackends/Software/SWRenderer.cpp b/Source/Core/VideoBackends/Software/SWRenderer.cpp index 4b57b9b551..a4ed1bed60 100644 --- a/Source/Core/VideoBackends/Software/SWRenderer.cpp +++ b/Source/Core/VideoBackends/Software/SWRenderer.cpp @@ -83,7 +83,7 @@ std::unique_ptr SWRenderer::CreateShaderFromBinary(ShaderStage s class SWPipeline final : public AbstractPipeline { public: - SWPipeline() : AbstractPipeline() {} + SWPipeline() = default; ~SWPipeline() override = default; }; diff --git a/Source/Core/VideoCommon/PostProcessing.cpp b/Source/Core/VideoCommon/PostProcessing.cpp index b1c9c42056..1f42bd52ca 100644 --- a/Source/Core/VideoCommon/PostProcessing.cpp +++ b/Source/Core/VideoCommon/PostProcessing.cpp @@ -275,7 +275,7 @@ void PostProcessingConfiguration::SaveOptionsConfiguration() break; case ConfigurationOption::OptionType::OPTION_INTEGER: { - std::string value = ""; + std::string value; for (size_t i = 0; i < it.second.m_integer_values.size(); ++i) value += StringFromFormat("%d%s", it.second.m_integer_values[i], i == (it.second.m_integer_values.size() - 1) ? "" : ", "); diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index 79e924771d..6860fc8992 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -1127,7 +1127,7 @@ TextureCacheBase::GetTexture(u32 address, u32 width, u32 height, const TextureFo entry->memory_stride = entry->BytesPerRow(); entry->SetNotCopy(); - std::string basename = ""; + std::string basename; if (g_ActiveConfig.bDumpTextures && !hires_tex) { basename = HiresTexture::GenBaseName(src_data, texture_size, &texMem[tlutaddr], palette_size, diff --git a/Source/UnitTests/Common/StringUtilTest.cpp b/Source/UnitTests/Common/StringUtilTest.cpp index cae007fdbe..b9b186c131 100644 --- a/Source/UnitTests/Common/StringUtilTest.cpp +++ b/Source/UnitTests/Common/StringUtilTest.cpp @@ -44,7 +44,7 @@ TEST(StringUtil, StringEndsWith) TEST(StringUtil, StringPopBackIf) { std::string abc = "abc"; - std::string empty = ""; + std::string empty; StringPopBackIf(&abc, 'a'); StringPopBackIf(&empty, 'a');