putil: Slight BamReader optimization

This commit is contained in:
rdb 2021-12-12 18:37:35 +01:00
parent eaf8cb79d5
commit 3ef5d96efc

View File

@ -545,12 +545,13 @@ read_handle(DatagramIterator &scan) {
string name = scan.get_string(); string name = scan.get_string();
bool new_type = false; bool new_type = false;
TypeHandle type = TypeRegistry::ptr()->find_type(name); TypeRegistry *type_registry = TypeRegistry::ptr();
TypeHandle type = type_registry->find_type(name);
if (type == TypeHandle::none()) { if (type == TypeHandle::none()) {
// We've never heard of this type before! This is really an error // We've never heard of this type before! This is really an error
// condition, but we'll do the best we can and declare it on-the-fly. // condition, but we'll do the best we can and declare it on-the-fly.
type = TypeRegistry::ptr()->register_dynamic_type(name); type = type_registry->register_dynamic_type(name);
bam_cat.warning() bam_cat.warning()
<< "Bam file '" << get_filename() << "' contains objects of unknown type: " << "Bam file '" << get_filename() << "' contains objects of unknown type: "
<< type << "\n"; << type << "\n";
@ -563,7 +564,7 @@ read_handle(DatagramIterator &scan) {
for (int i = 0; i < num_parent_classes; i++) { for (int i = 0; i < num_parent_classes; i++) {
TypeHandle parent_type = read_handle(scan); TypeHandle parent_type = read_handle(scan);
if (new_type) { if (new_type) {
TypeRegistry::ptr()->record_derivation(type, parent_type); type_registry->record_derivation(type, parent_type);
} else { } else {
if (type.get_parent_towards(parent_type) != parent_type) { if (type.get_parent_towards(parent_type) != parent_type) {
if (bam_cat.is_debug()) { if (bam_cat.is_debug()) {