diff options
| author | Glenn Smith <glenn@vector35.com> | 2024-03-19 15:41:12 -0400 |
|---|---|---|
| committer | Glenn Smith <glenn@vector35.com> | 2024-03-19 15:41:12 -0400 |
| commit | 8856095011304479986025802863189071553357 (patch) | |
| tree | 2873864d3aba03dd62b89e6e752a0b35d19d9bfa /python | |
| parent | aa68c7efdaf40964afe9af84612f50773d217b9b (diff) | |
Improve performance of BinaryView.type_archive_type_names
Diffstat (limited to 'python')
| -rw-r--r-- | python/binaryview.py | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/python/binaryview.py b/python/binaryview.py index 9dbb3e4d..4d0ca685 100644 --- a/python/binaryview.py +++ b/python/binaryview.py @@ -7881,17 +7881,16 @@ class BinaryView: Get a list of all available type names in all connected archives, and their archive/type id pair :return: name <-> [(archive, archive type id)] for all type names """ - names = ctypes.POINTER(core.BNQualifiedName)() - name_count = core.BNBinaryViewGetTypeArchiveTypeNameList(self.handle, names) - result = {} - try: - for i in range(0, name_count): - name = _types.QualifiedName._from_core_struct(names[i]) - result[name] = self.get_type_archives_for_type_name(name) - return result - finally: - core.BNFreeTypeNameList(names, name_count) + + archives = self.connected_type_archives + for archive in archives: + for (id, name) in archive.type_names_and_ids.items(): + if name in result: + result[name].append((archive, id)) + else: + result[name] = [(archive, id)] + return result def get_type_archives_for_type_name(self, name: '_types.QualifiedNameType') -> List[Tuple['typearchive.TypeArchive', str]]: """ |
