Merge pull request #2013 from lioncash/emplace
Use emplace_* functions where in-place construction is preferable
This commit is contained in:
commit
235fa05171
|
@ -203,7 +203,7 @@ IniFile::Section* IniFile::GetOrCreateSection(const std::string& sectionName)
|
||||||
Section* section = GetSection(sectionName);
|
Section* section = GetSection(sectionName);
|
||||||
if (!section)
|
if (!section)
|
||||||
{
|
{
|
||||||
sections.push_back(Section(sectionName));
|
sections.emplace_back(sectionName);
|
||||||
section = §ions.back();
|
section = §ions.back();
|
||||||
}
|
}
|
||||||
return section;
|
return section;
|
||||||
|
|
|
@ -101,7 +101,7 @@ void ReadReplacements(replace_v& replacements)
|
||||||
std::string replacement;
|
std::string replacement;
|
||||||
|
|
||||||
while (f >> letter >> replacement && replacement.size())
|
while (f >> letter >> replacement && replacement.size())
|
||||||
replacements.push_back(std::make_pair(letter, replacement));
|
replacements.emplace_back(letter, replacement);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ void LabelMap::RegisterLabel(const std::string &label, u16 lval, LabelType type)
|
||||||
label.c_str(), lval, old_value);
|
label.c_str(), lval, old_value);
|
||||||
DeleteLabel(label);
|
DeleteLabel(label);
|
||||||
}
|
}
|
||||||
labels.push_back(label_t(label, lval, type));
|
labels.emplace_back(label, lval, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LabelMap::DeleteLabel(const std::string &label)
|
void LabelMap::DeleteLabel(const std::string &label)
|
||||||
|
|
|
@ -434,7 +434,7 @@ inline s32 GCMemcardDirectory::SaveAreaRW(u32 block, bool writing)
|
||||||
int num_blocks = BE16(m_saves[i].m_gci_header.BlockCount);
|
int num_blocks = BE16(m_saves[i].m_gci_header.BlockCount);
|
||||||
while (num_blocks)
|
while (num_blocks)
|
||||||
{
|
{
|
||||||
m_saves[i].m_save_data.push_back(GCMBlock());
|
m_saves[i].m_save_data.emplace_back();
|
||||||
num_blocks--;
|
num_blocks--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,7 +186,7 @@ namespace JitILProfiler
|
||||||
static Block& Add(u64 codeHash)
|
static Block& Add(u64 codeHash)
|
||||||
{
|
{
|
||||||
const u32 _blockIndex = (u32)blocks.size();
|
const u32 _blockIndex = (u32)blocks.size();
|
||||||
blocks.push_back(Block());
|
blocks.emplace_back();
|
||||||
Block& block = blocks.back();
|
Block& block = blocks.back();
|
||||||
block.index = _blockIndex;
|
block.index = _blockIndex;
|
||||||
block.codeHash = codeHash;
|
block.codeHash = codeHash;
|
||||||
|
|
|
@ -153,7 +153,7 @@ namespace JitInterface
|
||||||
u64 timecost = block->ticCounter;
|
u64 timecost = block->ticCounter;
|
||||||
// Todo: tweak.
|
// Todo: tweak.
|
||||||
if (block->runCount >= 1)
|
if (block->runCount >= 1)
|
||||||
stats.push_back(BlockStat(i, cost));
|
stats.emplace_back(i, cost);
|
||||||
cost_sum += cost;
|
cost_sum += cost;
|
||||||
timecost_sum += timecost;
|
timecost_sum += timecost;
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,7 +175,7 @@ bool AnalyzeFunction(u32 startAddr, Symbol &func, int max_size)
|
||||||
if (target != INVALID_TARGET && instr.LK)
|
if (target != INVALID_TARGET && instr.LK)
|
||||||
{
|
{
|
||||||
//we found a branch-n-link!
|
//we found a branch-n-link!
|
||||||
func.calls.push_back(SCall(target,addr));
|
func.calls.emplace_back(target, addr);
|
||||||
func.flags &= ~FFLAG_LEAF;
|
func.flags &= ~FFLAG_LEAF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,7 +113,7 @@ void CARCodeAddEdit::SaveCheatData(wxCommandEvent& WXUNUSED (event))
|
||||||
u32 addr = std::stoul(pieces[0], nullptr, 16);
|
u32 addr = std::stoul(pieces[0], nullptr, 16);
|
||||||
u32 value = std::stoul(pieces[1], nullptr, 16);
|
u32 value = std::stoul(pieces[1], nullptr, 16);
|
||||||
|
|
||||||
decryptedLines.push_back(ActionReplay::AREntry(addr, value));
|
decryptedLines.emplace_back(addr, value);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (pieces.size() == 1)
|
else if (pieces.size() == 1)
|
||||||
|
|
|
@ -48,7 +48,7 @@ void CPatchAddEdit::CreateGUIControls(int _selection)
|
||||||
if (_selection == -1)
|
if (_selection == -1)
|
||||||
{
|
{
|
||||||
tempEntries.clear();
|
tempEntries.clear();
|
||||||
tempEntries.push_back(PatchEngine::PatchEntry(PatchEngine::PATCH_8BIT, 0x00000000, 0x00000000));
|
tempEntries.emplace_back(PatchEngine::PATCH_8BIT, 0x00000000, 0x00000000);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -128,9 +128,7 @@ void FramebufferManagerBase::CopyToVirtualXFB(u32 xfbAddr, u32 fbWidth, u32 fbHe
|
||||||
if (m_virtualXFBList.size() < MAX_VIRTUAL_XFB)
|
if (m_virtualXFBList.size() < MAX_VIRTUAL_XFB)
|
||||||
{
|
{
|
||||||
// create a new Virtual XFB and place it at the front of the list
|
// create a new Virtual XFB and place it at the front of the list
|
||||||
VirtualXFB v;
|
m_virtualXFBList.emplace_front();
|
||||||
memset(&v, 0, sizeof v);
|
|
||||||
m_virtualXFBList.push_front(v);
|
|
||||||
vxfb = m_virtualXFBList.begin();
|
vxfb = m_virtualXFBList.begin();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -57,14 +57,16 @@ public:
|
||||||
protected:
|
protected:
|
||||||
struct VirtualXFB
|
struct VirtualXFB
|
||||||
{
|
{
|
||||||
VirtualXFB() : xfbSource(nullptr) {}
|
VirtualXFB()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
// Address and size in GameCube RAM
|
// Address and size in GameCube RAM
|
||||||
u32 xfbAddr;
|
u32 xfbAddr = 0;
|
||||||
u32 xfbWidth;
|
u32 xfbWidth = 0;
|
||||||
u32 xfbHeight;
|
u32 xfbHeight = 0;
|
||||||
|
|
||||||
XFBSourceBase *xfbSource;
|
XFBSourceBase* xfbSource = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::list<VirtualXFB> VirtualXFBListType;
|
typedef std::list<VirtualXFB> VirtualXFBListType;
|
||||||
|
|
|
@ -129,7 +129,7 @@ void PostProcessingShaderConfiguration::LoadOptions(const std::string& code)
|
||||||
IniFile::ParseLine(line, &key, &value);
|
IniFile::ParseLine(line, &key, &value);
|
||||||
|
|
||||||
if (!(key == "" && value == ""))
|
if (!(key == "" && value == ""))
|
||||||
current_strings->m_options.push_back(std::make_pair(key, value));
|
current_strings->m_options.emplace_back(key, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue