@@ -77,7 +77,7 @@ const intern_string_t log_format::LOG_TIME_STR
7777const intern_string_t log_format::LOG_LEVEL_STR
7878 = intern_string::lookup(" log_level" );
7979
80- static const uint32_t DATE_TIME_SET_FLAGS = ETF_YEAR_SET | ETF_MONTH_SET
80+ static constexpr uint32_t DATE_TIME_SET_FLAGS = ETF_YEAR_SET | ETF_MONTH_SET
8181 | ETF_DAY_SET | ETF_HOUR_SET | ETF_MINUTE_SET | ETF_SECOND_SET;
8282
8383log_level_stats&
@@ -1830,10 +1830,10 @@ external_log_format::annotate(logfile* lf,
18301830 logline_value_vector& values,
18311831 bool annotate_module) const
18321832{
1833- static thread_local auto md = lnav::pcre2pp::match_data::unitialized ();
1833+ thread_local auto md = lnav::pcre2pp::match_data::unitialized ();
18341834
18351835 auto & line = values.lvv_sbr ;
1836- struct line_range lr;
1836+ line_range lr;
18371837
18381838 line.erase_ansi ();
18391839 if (this ->elf_type != elf_type_t ::ELF_TYPE_TEXT) {
@@ -1873,7 +1873,7 @@ external_log_format::annotate(logfile* lf,
18731873 values.lvv_values .reserve (this ->elf_value_defs .size ());
18741874
18751875 int pat_index = this ->pattern_index_for_line (line_number);
1876- auto & pat = *this ->elf_pattern_order [pat_index];
1876+ const auto & pat = *this ->elf_pattern_order [pat_index];
18771877
18781878 sa.reserve (pat.p_pcre .pp_value ->get_capture_count ());
18791879 auto match_res
@@ -1926,7 +1926,7 @@ external_log_format::annotate(logfile* lf,
19261926
19271927 for (size_t lpc = 0 ; lpc < pat.p_value_by_index .size (); lpc++) {
19281928 const indexed_value_def& ivd = pat.p_value_by_index [lpc];
1929- const struct scaling_factor * scaling = nullptr ;
1929+ const scaling_factor* scaling = nullptr ;
19301930 auto cap = md[ivd.ivd_index ];
19311931 const auto & vd = *ivd.ivd_value_def ;
19321932
@@ -1938,7 +1938,7 @@ external_log_format::annotate(logfile* lf,
19381938 = intern_string::lookup (unit_cap.value ());
19391939 auto unit_iter = vd.vd_unit_scaling .find (unit_val);
19401940 if (unit_iter != vd.vd_unit_scaling .end ()) {
1941- const struct scaling_factor & sf = unit_iter->second ;
1941+ const auto & sf = unit_iter->second ;
19421942
19431943 scaling = &sf;
19441944 }
@@ -3144,6 +3144,25 @@ external_log_format::build(std::vector<lnav::console::user_message>& errors)
31443144 for (auto & vd : this ->elf_value_def_order ) {
31453145 std::vector<std::string>::iterator act_iter;
31463146
3147+ if (log_vtab_impl::RESERVED_COLUMNS.count (
3148+ vd->vd_meta .lvm_name .to_string_fragment ()))
3149+ {
3150+ auto um = lnav::console::user_message::error (
3151+ attr_line_t (" value name " )
3152+ .append_quoted (lnav::roles::symbol (
3153+ fmt::format (FMT_STRING (" /{}/value/{}" ),
3154+ this ->elf_name ,
3155+ vd->vd_meta .lvm_name )))
3156+ .append (" is reserved and cannot be used" ))
3157+ .with_reason (
3158+ " lnav automatically defines several columns in "
3159+ " the log virtual table" )
3160+ .with_snippets (this ->get_snippets ())
3161+ .with_help (" Choose another name" )
3162+ .move ();
3163+ errors.emplace_back (um);
3164+ }
3165+
31473166 vd->vd_meta .lvm_format = this ;
31483167 if (!vd->vd_internal
31493168 && !vd->vd_meta .lvm_column .is <logline_value_meta::table_column>())
0 commit comments