diff options
| author | Rusty Wagner <rusty@vector35.com> | 2018-02-12 21:48:34 -0500 |
|---|---|---|
| committer | Rusty Wagner <rusty@vector35.com> | 2018-02-12 21:48:34 -0500 |
| commit | bba715aff1565426fba31e2f39c438f37921c303 (patch) | |
| tree | 9f1a0fd2b15d5d8bcc5d02a90449f0a7a3d6abc3 /lowlevelil.cpp | |
| parent | 79b5bdcf42f6abf1c8b2c4bda4c30b41319c4aa5 (diff) | |
| parent | c352fec480dde5321a0c52850be1bb8a3df9bbd3 (diff) | |
Merge branch 'dev' into fpu
Diffstat (limited to 'lowlevelil.cpp')
| -rw-r--r-- | lowlevelil.cpp | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/lowlevelil.cpp b/lowlevelil.cpp index 0f2b29be..91db6ab3 100644 --- a/lowlevelil.cpp +++ b/lowlevelil.cpp @@ -176,6 +176,7 @@ vector<uint64_t> LowLevelILFunction::GetOperandList(ExprId expr, size_t listOper size_t count; uint64_t* operands = BNLowLevelILGetOperandList(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]); BNLowLevelILFreeOperandList(operands); @@ -429,19 +430,10 @@ bool LowLevelILFunction::GetExprText(Architecture* arch, ExprId expr, vector<Ins 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; @@ -458,19 +450,10 @@ bool LowLevelILFunction::GetInstructionText(Function* func, Architecture* arch, 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; @@ -495,6 +478,7 @@ vector<Ref<BasicBlock>> LowLevelILFunction::GetBasicBlocks() const BNBasicBlock** blocks = BNGetLowLevelILBasicBlockList(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]))); |
