make eval visualization system robust to absence of auto view rule table

This commit is contained in:
Ryan Fleury
2024-09-19 15:23:55 -07:00
parent df4d18aa5c
commit 05ec402a8e
@@ -364,8 +364,8 @@ ev_auto_view_rule_table_push_new(Arena *arena, EV_AutoViewRuleTable *table, E_Ty
table->slots = push_array(arena, EV_AutoViewRuleSlot, table->slots_count); table->slots = push_array(arena, EV_AutoViewRuleSlot, table->slots_count);
} }
U64 hash = e_hash_from_string(5381, str8_struct(&type_key)); U64 hash = e_hash_from_string(5381, str8_struct(&type_key));
U64 slot_idx = hash%ev_auto_view_rule_table->slots_count; U64 slot_idx = hash%table->slots_count;
EV_AutoViewRuleSlot *slot = &ev_auto_view_rule_table->slots[slot_idx]; EV_AutoViewRuleSlot *slot = &table->slots[slot_idx];
EV_AutoViewRuleNode *node = 0; EV_AutoViewRuleNode *node = 0;
for(EV_AutoViewRuleNode *n = slot->first; n != 0; n = n->next) for(EV_AutoViewRuleNode *n = slot->first; n != 0; n = n->next)
{ {
@@ -393,6 +393,9 @@ ev_select_auto_view_rule_table(EV_AutoViewRuleTable *table)
internal String8 internal String8
ev_auto_view_rule_from_type_key(E_TypeKey type_key) ev_auto_view_rule_from_type_key(E_TypeKey type_key)
{ {
String8 string = {0};
if(ev_auto_view_rule_table != 0 && ev_auto_view_rule_table->slots_count != 0)
{
U64 hash = e_hash_from_string(5381, str8_struct(&type_key)); U64 hash = e_hash_from_string(5381, str8_struct(&type_key));
U64 slot_idx = hash%ev_auto_view_rule_table->slots_count; U64 slot_idx = hash%ev_auto_view_rule_table->slots_count;
EV_AutoViewRuleSlot *slot = &ev_auto_view_rule_table->slots[slot_idx]; EV_AutoViewRuleSlot *slot = &ev_auto_view_rule_table->slots[slot_idx];
@@ -405,11 +408,11 @@ ev_auto_view_rule_from_type_key(E_TypeKey type_key)
break; break;
} }
} }
String8 string = {0};
if(node != 0) if(node != 0)
{ {
string = node->view_rule; string = node->view_rule;
} }
}
return string; return string;
} }