Skip to content

Commit 9a19bd4

Browse files
committed
[tidy] minor cleanups
1 parent b09a112 commit 9a19bd4

File tree

9 files changed

+30
-14
lines changed

9 files changed

+30
-14
lines changed

src/all_logs_vtab.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "all_logs_vtab.hh"
3131

3232
#include "base/attr_line.hh"
33+
#include "base/intern_string.hh"
3334
#include "config.h"
3435
#include "data_parser.hh"
3536
#include "elem_to_json.hh"

src/all_logs_vtab.hh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,12 @@
3030
#ifndef lnav_all_logs_vtab_hh
3131
#define lnav_all_logs_vtab_hh
3232

33-
#include <array>
33+
#include <cstdint>
34+
#include <vector>
3435

36+
#include "log_format.hh"
3537
#include "log_vtab_impl.hh"
38+
#include "logfile.hh"
3639

3740
/**
3841
* A virtual table that provides access to all log messages from all formats.

src/grep_proc.hh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ public:
7070
* @param line The line to retrieve.
7171
* @param value_out The destination for the line value.
7272
*/
73-
virtual std::optional<line_info> grep_value_for_line(LineType line, std::string& value_out) = 0;
73+
virtual std::optional<line_info> grep_value_for_line(LineType line,
74+
std::string& value_out)
75+
= 0;
7476

7577
virtual LineType grep_initial_line(LineType start, LineType highest)
7678
{
@@ -165,7 +167,7 @@ public:
165167

166168
using injectable = grep_proc(std::shared_ptr<pollable_supervisor>);
167169

168-
virtual ~grep_proc();
170+
~grep_proc() override;
169171

170172
/** @param gpd The sink to send results to. */
171173
void set_sink(grep_proc_sink<LineType>* gpd) { this->gp_sink = gpd; }

src/input_dispatcher.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ input_dispatcher::new_input(const struct timeval& current_time,
7979
ch.utf8,
8080
eff_str.c_str(),
8181
ch.evtype);
82+
if (ncinput_mouse_p(&ch)) {
83+
log_debug(" mouse [x=%d;y=%d]", ch.x, ch.y);
84+
}
8285
if (!ncinput_mouse_p(&ch) && ch.evtype == NCTYPE_RELEASE) {
8386
return;
8487
}
@@ -106,7 +109,8 @@ input_dispatcher::new_input(const struct timeval& current_time,
106109
}).unwrapOr(size_t{1});
107110
log_debug("seq_size %d", seq_size);
108111
if (seq_size == 1) {
109-
snprintf(keyseq.data(), keyseq.size(), "x%02x", ch.eff_text[0] & 0xff);
112+
snprintf(
113+
keyseq.data(), keyseq.size(), "x%02x", ch.eff_text[0] & 0xff);
110114
log_debug("key %s", keyseq.data());
111115
handled = this->id_key_handler(nc, ch, keyseq.data());
112116
}

src/lnav_util.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@
4242

4343
#include <fcntl.h>
4444
#include <poll.h>
45+
#include <stdio.h>
4546
#include <sys/resource.h>
4647
#include <sys/time.h>
4748
#include <sys/types.h>
4849
#include <time.h>
4950

50-
#include "base/auto_mem.hh"
5151
#include "base/intern_string.hh"
5252
#include "base/lnav.console.hh"
5353
#include "base/result.h"

src/log_format_loader.hh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include "base/intern_string.hh"
4242
#include "base/lnav.console.hh"
4343
#include "shlex.resolver.hh"
44+
#include "yajlpp/yajlpp_def.hh"
4445

4546
class log_vtab_manager;
4647

@@ -66,7 +67,7 @@ struct script_metadata {
6667
std::string sm_description;
6768
};
6869

69-
void extract_metadata_from_file(struct script_metadata& meta_inout);
70+
void extract_metadata_from_file(script_metadata& meta_inout);
7071

7172
struct available_scripts {
7273
std::map<std::string, std::vector<script_metadata>> as_scripts;
@@ -75,7 +76,7 @@ struct available_scripts {
7576
void find_format_scripts(const std::vector<std::filesystem::path>& extra_paths,
7677
available_scripts& scripts);
7778

78-
extern const struct json_path_container format_handlers;
79-
extern const struct json_path_container root_format_handler;
79+
extern const json_path_container format_handlers;
80+
extern const json_path_container root_format_handler;
8081

8182
#endif

src/md4cpp.hh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include <map>
3434
#include <string>
3535
#include <unordered_map>
36+
#include <vector>
3637

3738
#include "base/intern_string.hh"
3839
#include "base/result.h"
@@ -143,7 +144,8 @@ std::string escape_html(const std::string& content);
143144

144145
namespace literals {
145146

146-
inline std::string operator"" _emoji(const char* str, std::size_t len)
147+
inline std::string
148+
operator"" _emoji(const char* str, std::size_t len)
147149
{
148150
const auto& em = get_emoji_map();
149151
const auto key = std::string(str, len);

src/sql_help.hh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,11 @@
3333
#define sql_help_hh
3434

3535
#include <map>
36+
#include <string>
37+
#include <vector>
3638

3739
#include "base/attr_line.hh"
40+
#include "base/intern_string.hh"
3841
#include "help_text.hh"
3942

4043
extern string_attr_type<void> SQL_COMMAND_ATTR;
@@ -78,7 +81,7 @@ bool is_prql(const string_fragment& sf);
7881

7982
void annotate_prql_statement(attr_line_t& al);
8083

81-
extern const char* prql_keywords[];
84+
extern const char* const prql_keywords[];
8285
extern std::multimap<std::string, const help_text*> prql_functions;
8386

8487
} // namespace sql
@@ -87,7 +90,7 @@ namespace prql {
8790

8891
std::string quote_ident(std::string id);
8992

90-
}
93+
} // namespace prql
9194

9295
} // namespace lnav
9396

src/sql_util.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,7 @@ annotate_sql_statement(attr_line_t& al)
10561056
= lnav::pcre2pp::code::from_const(R"(^;?(\.\w+))");
10571057
static const auto ws_pattern = lnav::pcre2pp::code::from_const(R"(\A\s+)");
10581058

1059-
auto& line = al.get_string();
1059+
const auto& line = al.get_string();
10601060
auto& sa = al.get_attrs();
10611061

10621062
if (lnav::sql::is_prql(line)) {
@@ -1282,7 +1282,7 @@ is_prql(const string_fragment& sf)
12821282
return (trimmed.startswith("let ") || trimmed.startswith("from"));
12831283
}
12841284

1285-
const char* prql_transforms[] = {
1285+
static const char* const prql_transforms[] = {
12861286
"aggregate",
12871287
"append",
12881288
"derive",
@@ -1299,7 +1299,7 @@ const char* prql_transforms[] = {
12991299
nullptr,
13001300
};
13011301

1302-
const char* prql_keywords[] = {
1302+
const char* const prql_keywords[] = {
13031303
"average", "avg", "case", "count", "count_distinct", "false", "func",
13041304
"into", "let", "max", "min", "module", "null", "prql",
13051305
"stddev", "sum", "true", "type",

0 commit comments

Comments
 (0)