From 1df49afa5522d73d509d20db9588294fe259085f Mon Sep 17 00:00:00 2001 From: Brian Potchik Date: Thu, 11 Jan 2018 17:10:34 -0500 Subject: API Temporary Object Elimination. --- type.cpp | 36 ++++++------------------------------ 1 file changed, 6 insertions(+), 30 deletions(-) (limited to 'type.cpp') diff --git a/type.cpp b/type.cpp index 40a69ae2..c158f53e 100644 --- a/type.cpp +++ b/type.cpp @@ -476,16 +476,8 @@ vector Type::GetTokens(Platform* platform, uint8_t baseCon vector result; for (size_t i = 0; i < count; i++) { - InstructionTextToken token; - token.type = tokens[i].type; - token.text = tokens[i].text; - token.value = tokens[i].value; - token.size = tokens[i].size; - token.operand = tokens[i].operand; - token.context = tokens[i].context; - token.confidence = tokens[i].confidence; - token.address = tokens[i].address; - result.push_back(token); + result.emplace_back(tokens[i].type, tokens[i].context, tokens[i].text, tokens[i].address, tokens[i].value, tokens[i].size, + tokens[i].operand, tokens[i].confidence); } BNFreeTokenList(tokens, count); @@ -502,16 +494,8 @@ vector Type::GetTokensBeforeName(Platform* platform, uint8 vector result; for (size_t i = 0; i < count; i++) { - InstructionTextToken token; - token.type = tokens[i].type; - token.text = tokens[i].text; - token.value = tokens[i].value; - token.size = tokens[i].size; - token.operand = tokens[i].operand; - token.context = tokens[i].context; - token.confidence = tokens[i].confidence; - token.address = tokens[i].address; - result.push_back(token); + result.emplace_back(tokens[i].type, tokens[i].context, tokens[i].text, tokens[i].address, tokens[i].value, tokens[i].size, + tokens[i].operand, tokens[i].confidence); } BNFreeTokenList(tokens, count); @@ -528,16 +512,8 @@ vector Type::GetTokensAfterName(Platform* platform, uint8_ vector result; for (size_t i = 0; i < count; i++) { - InstructionTextToken token; - token.type = tokens[i].type; - token.text = tokens[i].text; - token.value = tokens[i].value; - token.size = tokens[i].size; - token.operand = tokens[i].operand; - token.context = tokens[i].context; - token.confidence = tokens[i].confidence; - token.address = tokens[i].address; - result.push_back(token); + result.emplace_back(tokens[i].type, tokens[i].context, tokens[i].text, tokens[i].address, tokens[i].value, tokens[i].size, + tokens[i].operand, tokens[i].confidence); } BNFreeTokenList(tokens, count); -- cgit v1.3.1