diff options
| author | Peter LaFosse <peter@vector35.com> | 2018-12-03 22:20:28 -0500 |
|---|---|---|
| committer | Peter LaFosse <peter@vector35.com> | 2018-12-13 13:32:18 -0500 |
| commit | 231afab8b0ba6c8c9eff879681c52724b6688c18 (patch) | |
| tree | 38026cfa20f34702b7267e9c397652119f27ebe7 /python/types.py | |
| parent | 7357dd114a145ca64e7356233c3cb8b9dd9eae84 (diff) | |
Commonize all InstructionTextToken generation
Diffstat (limited to 'python/types.py')
| -rw-r--r-- | python/types.py | 42 |
1 files changed, 6 insertions, 36 deletions
diff --git a/python/types.py b/python/types.py index 05e531e1..e6913f93 100644 --- a/python/types.py +++ b/python/types.py @@ -455,18 +455,8 @@ class Type(object): if self.platform is not None: platform = self.platform.handle tokens = core.BNGetTypeTokens(self.handle, platform, base_confidence, count) - result = [] - for i in range(0, count.value): - token_type = InstructionTextTokenType(tokens[i].type) - text = tokens[i].text - value = tokens[i].value - size = tokens[i].size - operand = tokens[i].operand - context = tokens[i].context - confidence = tokens[i].confidence - address = tokens[i].address - result.append(binaryninja.function.InstructionTextToken(token_type, text, value, size, operand, context, address, confidence)) - core.BNFreeTokenList(tokens, count.value) + result = binaryninja.function.InstructionTextToken.get_instruction_lines(tokens, count.value) + core.BNFreeInstructionText(tokens, count.value) return result def get_tokens_before_name(self, base_confidence = max_confidence): @@ -475,18 +465,8 @@ class Type(object): if self.platform is not None: platform = self.platform.handle tokens = core.BNGetTypeTokensBeforeName(self.handle, platform, base_confidence, count) - result = [] - for i in range(0, count.value): - token_type = InstructionTextTokenType(tokens[i].type) - text = tokens[i].text - value = tokens[i].value - size = tokens[i].size - operand = tokens[i].operand - context = tokens[i].context - confidence = tokens[i].confidence - address = tokens[i].address - result.append(binaryninja.function.InstructionTextToken(token_type, text, value, size, operand, context, address, confidence)) - core.BNFreeTokenList(tokens, count.value) + result = binaryninja.function.InstructionTextToken.get_instruction_lines(tokens, count.value) + core.BNFreeInstructionText(tokens, count.value) return result def get_tokens_after_name(self, base_confidence = max_confidence): @@ -495,18 +475,8 @@ class Type(object): if self.platform is not None: platform = self.platform.handle tokens = core.BNGetTypeTokensAfterName(self.handle, platform, base_confidence, count) - result = [] - for i in range(0, count.value): - token_type = InstructionTextTokenType(tokens[i].type) - text = tokens[i].text - value = tokens[i].value - size = tokens[i].size - operand = tokens[i].operand - context = tokens[i].context - confidence = tokens[i].confidence - address = tokens[i].address - result.append(binaryninja.function.InstructionTextToken(token_type, text, value, size, operand, context, address, confidence)) - core.BNFreeTokenList(tokens, count.value) + result = binaryninja.function.InstructionTextToken.get_instruction_lines(tokens, count.value) + core.BNFreeInstructionText(tokens, count.value) return result @classmethod |
