@@ -4494,33 +4494,12 @@ external_log_format::convert_level(string_fragment sf,
44944494 auto retval = LEVEL_INFO ;
44954495
44964496 if (sf.is_valid ()) {
4497- // std::optional<uint32_t> ssm_res;
44984497 if (sbc != nullptr ) {
44994498 auto ssm_res = sbc->sbc_level_cache .lookup (sf);
45004499 if (ssm_res.has_value ()) {
45014500 return static_cast <log_level_t >(ssm_res.value ());
45024501 }
45034502 }
4504- #if 0
4505- if (sbc != nullptr && sbc->sbc_cached_level_count > 0) {
4506- const auto level_end = std::begin(sbc->sbc_cached_level_strings)
4507- + sbc->sbc_cached_level_count;
4508- const auto cached_level_iter = std::find(
4509- std::begin(sbc->sbc_cached_level_strings), level_end, sf);
4510- if (cached_level_iter != level_end) {
4511- const auto cache_index
4512- = std::distance(std::begin(sbc->sbc_cached_level_strings),
4513- cached_level_iter);
4514- if (cache_index != 0) {
4515- std::swap(sbc->sbc_cached_level_strings[cache_index],
4516- sbc->sbc_cached_level_strings[0]);
4517- std::swap(sbc->sbc_cached_level_values[cache_index],
4518- sbc->sbc_cached_level_values[0]);
4519- }
4520- return sbc->sbc_cached_level_values[0];
4521- }
4522- }
4523- #endif
45244503
45254504 if (this ->elf_level_patterns .empty ()) {
45264505 retval = string2level (sf.data (), sf.length ());
@@ -4537,19 +4516,9 @@ external_log_format::convert_level(string_fragment sf,
45374516 }
45384517 }
45394518
4540- if (sbc != nullptr && sf.length () < 8 ) {
4541- #if 0
4542- size_t cache_index;
4543-
4544- if (sbc->sbc_cached_level_count == 4) {
4545- cache_index = sbc->sbc_cached_level_count - 1;
4546- } else {
4547- cache_index = sbc->sbc_cached_level_count;
4548- sbc->sbc_cached_level_count += 1;
4549- }
4550- sbc->sbc_cached_level_strings[cache_index] = sf.to_string();
4551- sbc->sbc_cached_level_values[cache_index] = retval;
4552- #endif
4519+ if (sbc != nullptr
4520+ && sf.length () <= lnav::small_string_map::MAX_KEY_SIZE )
4521+ {
45534522 sbc->sbc_level_cache .insert (sf, retval);
45544523 }
45554524 }
0 commit comments