Skip to content
Permalink
Browse files

Merge pull request #7839 from ShFil119/impr/redundant

Remove redundant initialization
  • Loading branch information...
leoetlino committed May 4, 2019
2 parents afa46aa + c110ffc commit 99a4ca8de7111c8554b50217744e24bc71912cfe
@@ -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()
{
@@ -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;
@@ -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)
@@ -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++]);
@@ -106,7 +106,7 @@ void WiimoteScannerLinux::FindWiimotes(std::vector<Wiimote*>& found_wiimotes, Wi
}
}

WiimoteLinux::WiimoteLinux(bdaddr_t bdaddr) : Wiimote(), m_bdaddr(bdaddr)
WiimoteLinux::WiimoteLinux(bdaddr_t bdaddr) : m_bdaddr(bdaddr)
{
m_really_disconnect = true;

@@ -52,6 +52,8 @@ std::mutex g_wiimotes_mutex;
std::unique_ptr<Wiimote> g_wiimotes[MAX_BBMOTES];
WiimoteScanner g_wiimote_scanner;

Wiimote::Wiimote() = default;

void Wiimote::Shutdown()
{
std::lock_guard<std::mutex> lk(s_known_ids_mutex);
@@ -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 @@ class Wiimote
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.
@@ -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<u8, 16> s_MD5;
static u8 s_bongos, s_memcards;
static std::array<u8, 20> s_revision;
@@ -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];
@@ -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]);

@@ -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):
@@ -63,7 +63,7 @@ std::unique_ptr<AbstractShader> Renderer::CreateShaderFromBinary(ShaderStage sta
class NullPipeline final : public AbstractPipeline
{
public:
NullPipeline() : AbstractPipeline() {}
NullPipeline() = default;
~NullPipeline() override = default;
};

@@ -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<u64> s_shader_counter{0};
static thread_local bool s_is_shared_context = false;

@@ -663,7 +663,7 @@ void ProgramShaderCache::CreateHeader()
break;
}

std::string earlyz_string = "";
std::string earlyz_string;
if (g_ActiveConfig.backend_info.bSupportsEarlyZ)
{
if (g_ogl_config.bSupportsImageLoadStore)
@@ -82,7 +82,7 @@ std::unique_ptr<AbstractShader> SWRenderer::CreateShaderFromBinary(ShaderStage s
class SWPipeline final : public AbstractPipeline
{
public:
SWPipeline() : AbstractPipeline() {}
SWPipeline() = default;
~SWPipeline() override = default;
};

@@ -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) ? "" : ", ");
@@ -1128,7 +1128,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,
@@ -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');

0 comments on commit 99a4ca8

Please sign in to comment.
You can’t perform that action at this time.