dead code elimination

This commit is contained in:
Ryan Fleury committed 2024-10-14 11:04:28 -07:00
1 parent e2722e45c8
commit 9169c14e24
2 files changed
-313

No files matched your search

-90
View File
@@ -14533,96 +14533,6 @@ rd_frame(void)
}
}
}
#if 0 // TODO(rjf): @msgs
RD_Entity *file = &d_nil_entity;
if(name_resolved == 0)
{
RD_Entity *src_entity = rd_entity_from_handle(rd_regs()->entity);
String8 file_part_of_name = name;
U64 quote_pos = str8_find_needle(name, 0, str8_lit("\""), 0);
if(quote_pos < name.size)
{
file_part_of_name = str8_skip(name, quote_pos+1);
U64 ender_quote_pos = str8_find_needle(file_part_of_name, 0, str8_lit("\""), 0);
file_part_of_name = str8_prefix(file_part_of_name, ender_quote_pos);
}
if(file_part_of_name.size != 0)
{
String8 folder_path = str8_chop_last_slash(file_part_of_name);
String8 file_name = str8_skip_last_slash(file_part_of_name);
String8List folders = str8_split_path(scratch.arena, folder_path);
// rjf: some folders are specified
if(folders.node_count != 0)
{
String8 first_folder_name = folders.first->string;
RD_Entity *root_folder = &d_nil_entity;
// rjf: try to find root folder as if it's an absolute path
if(rd_entity_is_nil(root_folder))
{
root_folder = d_entity_from_path(first_folder_name, D_EntityFromPathFlag_OpenAsNeeded);
}
// rjf: try to find root folder as if it's a path we've already loaded
if(rd_entity_is_nil(root_folder))
{
root_folder = rd_entity_from_name_and_kind(first_folder_name, RD_EntityKind_File);
}
// rjf: try to find root folder as if it's inside of a path we've already loaded
if(rd_entity_is_nil(root_folder))
{
RD_EntityList all_files = rd_query_cached_entity_list_with_kind(RD_EntityKind_File);
for(RD_EntityNode *n = all_files.first; n != 0; n = n->next)
{
if(n->entity->flags & RD_EntityFlag_IsFolder)
{
String8 n_entity_path = rd_full_path_from_entity(scratch.arena, n->entity);
String8 estimated_full_path = push_str8f(scratch.arena, "%S/%S", n_entity_path, first_folder_name);
root_folder = d_entity_from_path(estimated_full_path, D_EntityFromPathFlag_OpenAsNeeded);
if(!rd_entity_is_nil(root_folder))
{
break;
}
}
}
}
// rjf: has root folder -> descend downwards
if(!rd_entity_is_nil(root_folder))
{
String8 root_folder_path = rd_full_path_from_entity(scratch.arena, root_folder);
String8List full_file_path_parts = {0};
str8_list_push(scratch.arena, &full_file_path_parts, root_folder_path);
for(String8Node *n = folders.first->next; n != 0; n = n->next)
{
str8_list_push(scratch.arena, &full_file_path_parts, n->string);
}
str8_list_push(scratch.arena, &full_file_path_parts, file_name);
StringJoin join = {0};
join.sep = str8_lit("/");
String8 full_file_path = str8_list_join(scratch.arena, &full_file_path_parts, &join);
file = d_entity_from_path(full_file_path, D_EntityFromPathFlag_AllowOverrides|D_EntityFromPathFlag_OpenAsNeeded|D_EntityFromPathFlag_OpenMissing);
}
}
// rjf: no folders specified => just try the local folder, then try globally
else if(src_entity->kind == RD_EntityKind_File)
{
file = rd_entity_from_name_and_kind(file_name, RD_EntityKind_File);
if(rd_entity_is_nil(file))
{
String8 src_entity_full_path = rd_full_path_from_entity(scratch.arena, src_entity);
String8 src_entity_folder = str8_chop_last_slash(src_entity_full_path);
String8 estimated_full_path = push_str8f(scratch.arena, "%S/%S", src_entity_folder, file_name);
file = d_entity_from_path(estimated_full_path, D_EntityFromPathFlag_All);
}
}
}
name_resolved = !rd_entity_is_nil(file) && !(file->flags & RD_EntityFlag_IsMissing) && !(file->flags & RD_EntityFlag_IsFolder);
}
#endif
// rjf: process resolved info
if(!name_resolved)