summaryrefslogtreecommitdiff
path: root/mediumlevelil.cpp
diff options
context:
space:
mode:
authorRusty Wagner <rusty@vector35.com>2018-02-12 21:48:34 -0500
committerRusty Wagner <rusty@vector35.com>2018-02-12 21:48:34 -0500
commitbba715aff1565426fba31e2f39c438f37921c303 (patch)
tree9f1a0fd2b15d5d8bcc5d02a90449f0a7a3d6abc3 /mediumlevelil.cpp
parent79b5bdcf42f6abf1c8b2c4bda4c30b41319c4aa5 (diff)
parentc352fec480dde5321a0c52850be1bb8a3df9bbd3 (diff)
Merge branch 'dev' into fpu
Diffstat (limited to 'mediumlevelil.cpp')
-rw-r--r--mediumlevelil.cpp33
1 files changed, 9 insertions, 24 deletions
diff --git a/mediumlevelil.cpp b/mediumlevelil.cpp
index 04a7341f..0a28bd49 100644
--- a/mediumlevelil.cpp
+++ b/mediumlevelil.cpp
@@ -157,6 +157,7 @@ vector<uint64_t> MediumLevelILFunction::GetOperandList(ExprId expr, size_t listO
size_t count;
uint64_t* operands = BNMediumLevelILGetOperandList(m_object, expr, listOperand, &count);
vector<uint64_t> result;
+ result.reserve(count);
for (size_t i = 0; i < count; i++)
result.push_back(operands[i]);
BNMediumLevelILFreeOperandList(operands);
@@ -338,19 +339,10 @@ bool MediumLevelILFunction::GetExprText(Architecture* arch, ExprId expr, vector<
return false;
tokens.clear();
+ tokens.reserve(count);
for (size_t i = 0; i < count; i++)
- {
- InstructionTextToken token;
- token.type = list[i].type;
- token.text = list[i].text;
- token.value = list[i].value;
- token.size = list[i].size;
- token.operand = list[i].operand;
- token.context = list[i].context;
- token.confidence = list[i].confidence;
- token.address = list[i].address;
- tokens.push_back(token);
- }
+ tokens.emplace_back(list[i].type, list[i].context, list[i].text, list[i].address, list[i].value, list[i].size,
+ list[i].operand, list[i].confidence);
BNFreeInstructionText(list, count);
return true;
@@ -367,19 +359,10 @@ bool MediumLevelILFunction::GetInstructionText(Function* func, Architecture* arc
return false;
tokens.clear();
+ tokens.reserve(count);
for (size_t i = 0; i < count; i++)
- {
- InstructionTextToken token;
- token.type = list[i].type;
- token.text = list[i].text;
- token.value = list[i].value;
- token.size = list[i].size;
- token.operand = list[i].operand;
- token.context = list[i].context;
- token.confidence = list[i].confidence;
- token.address = list[i].address;
- tokens.push_back(token);
- }
+ tokens.emplace_back(list[i].type, list[i].context, list[i].text, list[i].address, list[i].value, list[i].size,
+ list[i].operand, list[i].confidence);
BNFreeInstructionText(list, count);
return true;
@@ -412,6 +395,7 @@ vector<Ref<BasicBlock>> MediumLevelILFunction::GetBasicBlocks() const
BNBasicBlock** blocks = BNGetMediumLevelILBasicBlockList(m_object, &count);
vector<Ref<BasicBlock>> result;
+ result.reserve(count);
for (size_t i = 0; i < count; i++)
result.push_back(new BasicBlock(BNNewBasicBlockReference(blocks[i])));
@@ -696,6 +680,7 @@ unordered_map<size_t, BNILBranchDependence> MediumLevelILFunction::GetAllBranchD
BNILBranchInstructionAndDependence* deps = BNGetAllMediumLevelILBranchDependence(m_object, instr, &count);
unordered_map<size_t, BNILBranchDependence> result;
+ result.reserve(count);
for (size_t i = 0; i < count; i++)
result[deps[i].branch] = deps[i].dependence;