diff options
Diffstat (limited to 'function.cpp')
| -rw-r--r-- | function.cpp | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/function.cpp b/function.cpp index ba2b419e..da716699 100644 --- a/function.cpp +++ b/function.cpp @@ -516,11 +516,7 @@ Confidence<vector<Variable>> Function::GetParameterVariables() const vector<Variable> varList; for (size_t i = 0; i < vars.count; i++) { - Variable var; - var.type = vars.vars[i].type; - var.index = vars.vars[i].index; - var.storage = vars.vars[i].storage; - varList.push_back(var); + varList.emplace_back(vars.vars[i].type, vars.vars[i].index, vars.vars[i].storage); } Confidence<vector<Variable>> result(varList, vars.confidence); BNFreeParameterVariables(&vars); @@ -606,13 +602,14 @@ void Function::SetAutoCallingConvention(const Confidence<Ref<CallingConvention>> void Function::SetAutoParameterVariables(const Confidence<vector<Variable>>& vars) { BNParameterVariablesWithConfidence varConf; - varConf.vars = new BNVariable[vars.GetValue().size()]; - varConf.count = vars.GetValue().size(); - for (size_t i = 0; i < vars.GetValue().size(); i++) + varConf.vars = new BNVariable[vars->size()]; + varConf.count = vars->size(); + size_t i = 0; + for (auto it = vars->begin(); it != vars->end(); ++it, ++i) { - varConf.vars[i].type = vars.GetValue()[i].type; - varConf.vars[i].index = vars.GetValue()[i].index; - varConf.vars[i].storage = vars.GetValue()[i].storage; + varConf.vars[i].type = it->type; + varConf.vars[i].index = it->index; + varConf.vars[i].storage = it->storage; } varConf.confidence = vars.GetConfidence(); @@ -667,11 +664,12 @@ void Function::SetAutoRegisterStackAdjustments(const map<uint32_t, Confidence<in void Function::SetAutoClobberedRegisters(const Confidence<std::set<uint32_t>>& clobbered) { BNRegisterSetWithConfidence regs; - regs.regs = new uint32_t[clobbered.GetValue().size()]; - regs.count = clobbered.GetValue().size(); + regs.regs = new uint32_t[clobbered->size()]; + regs.count = clobbered->size(); + size_t i = 0; - for (auto reg : clobbered.GetValue()) - regs.regs[i++] = reg; + for (auto it = clobbered->begin(); it != clobbered->end(); ++it, ++i) + regs.regs[i] = *it; regs.confidence = clobbered.GetConfidence(); BNSetAutoFunctionClobberedRegisters(m_object, ®s); delete[] regs.regs; @@ -718,13 +716,14 @@ void Function::SetCallingConvention(const Confidence<Ref<CallingConvention>>& co void Function::SetParameterVariables(const Confidence<vector<Variable>>& vars) { BNParameterVariablesWithConfidence varConf; - varConf.vars = new BNVariable[vars.GetValue().size()]; - varConf.count = vars.GetValue().size(); - for (size_t i = 0; i < vars.GetValue().size(); i++) + varConf.vars = new BNVariable[vars->size()]; + varConf.count = vars->size(); + size_t i = 0; + for (auto it = vars->begin(); it != vars->end(); ++it, ++i) { - varConf.vars[i].type = vars.GetValue()[i].type; - varConf.vars[i].index = vars.GetValue()[i].index; - varConf.vars[i].storage = vars.GetValue()[i].storage; + varConf.vars[i].type = it->type; + varConf.vars[i].index = it->index; + varConf.vars[i].storage = it->storage; } varConf.confidence = vars.GetConfidence(); @@ -779,11 +778,11 @@ void Function::SetRegisterStackAdjustments(const map<uint32_t, Confidence<int32_ void Function::SetClobberedRegisters(const Confidence<std::set<uint32_t>>& clobbered) { BNRegisterSetWithConfidence regs; - regs.regs = new uint32_t[clobbered.GetValue().size()]; - regs.count = clobbered.GetValue().size(); + regs.regs = new uint32_t[clobbered->size()]; + regs.count = clobbered->size(); size_t i = 0; - for (auto reg : clobbered.GetValue()) - regs.regs[i++] = reg; + for (auto it = clobbered->begin(); it != clobbered->end(); ++it, ++i) + regs.regs[i] = *it; regs.confidence = clobbered.GetConfidence(); BNSetUserFunctionClobberedRegisters(m_object, ®s); delete[] regs.regs; |
