mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-07-14 13:31:25 -07:00
simplify fuzzy matching path to a single query
This commit is contained in:
@@ -1661,9 +1661,12 @@ rgba_from_hex_string_4f32(String8 hex_string)
|
||||
//~ rjf: String Fuzzy Matching
|
||||
|
||||
internal FuzzyMatchRangeList
|
||||
fuzzy_match_find(Arena *arena, String8List needles, String8 haystack)
|
||||
fuzzy_match_find(Arena *arena, String8 needle, String8 haystack)
|
||||
{
|
||||
FuzzyMatchRangeList result = {0};
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
String8List needles = str8_split(scratch.arena, needle, (U8*)" ", 1, 0);
|
||||
result.needle_part_count = needles.node_count;
|
||||
for(String8Node *needle_n = needles.first; needle_n != 0; needle_n = needle_n->next)
|
||||
{
|
||||
U64 find_pos = 0;
|
||||
@@ -1695,6 +1698,7 @@ fuzzy_match_find(Arena *arena, String8List needles, String8 haystack)
|
||||
result.total_dim += dim_1u64(range);
|
||||
}
|
||||
}
|
||||
scratch_end(scratch);
|
||||
return result;
|
||||
}
|
||||
////////////////////////////////
|
||||
|
||||
@@ -144,6 +144,7 @@ struct FuzzyMatchRangeList
|
||||
FuzzyMatchRangeNode *first;
|
||||
FuzzyMatchRangeNode *last;
|
||||
U64 count;
|
||||
U64 needle_part_count;
|
||||
U64 total_dim;
|
||||
};
|
||||
|
||||
@@ -340,7 +341,7 @@ internal Vec4F32 rgba_from_hex_string_4f32(String8 hex_string);
|
||||
////////////////////////////////
|
||||
//~ rjf: String Fuzzy Matching
|
||||
|
||||
internal FuzzyMatchRangeList fuzzy_match_find(Arena *arena, String8List needles, String8 haystack);
|
||||
internal FuzzyMatchRangeList fuzzy_match_find(Arena *arena, String8 needle, String8 haystack);
|
||||
|
||||
////////////////////////////////
|
||||
//~ NOTE(allen): Serialization Helpers
|
||||
|
||||
Reference in New Issue
Block a user