[tidy] remove duplicate struct names

Fixes #1004
pull/1062/head
Tim Stack 2 years ago
parent b2abf94c2e
commit 81fc0dc47e

@ -46,7 +46,7 @@ CREATE TABLE environ (
); );
)"; )";
struct vtab { struct env_vtab {
sqlite3_vtab base; sqlite3_vtab base;
sqlite3* db; sqlite3* db;
}; };
@ -66,10 +66,10 @@ vt_create(sqlite3* db,
sqlite3_vtab** pp_vt, sqlite3_vtab** pp_vt,
char** pzErr) char** pzErr)
{ {
vtab* p_vt; env_vtab* p_vt;
/* Allocate the sqlite3_vtab/vtab structure itself */ /* Allocate the sqlite3_vtab/vtab structure itself */
p_vt = (vtab*) sqlite3_malloc(sizeof(*p_vt)); p_vt = (env_vtab*) sqlite3_malloc(sizeof(*p_vt));
if (p_vt == NULL) { if (p_vt == NULL) {
return SQLITE_NOMEM; return SQLITE_NOMEM;
@ -88,7 +88,7 @@ vt_create(sqlite3* db,
static int static int
vt_destructor(sqlite3_vtab* p_svt) vt_destructor(sqlite3_vtab* p_svt)
{ {
vtab* p_vt = (vtab*) p_svt; env_vtab* p_vt = (env_vtab*) p_svt;
/* Free the SQLite structure */ /* Free the SQLite structure */
sqlite3_free(p_vt); sqlite3_free(p_vt);
@ -124,7 +124,7 @@ static int vt_next(sqlite3_vtab_cursor* cur);
static int static int
vt_open(sqlite3_vtab* p_svt, sqlite3_vtab_cursor** pp_cursor) vt_open(sqlite3_vtab* p_svt, sqlite3_vtab_cursor** pp_cursor)
{ {
vtab* p_vt = (vtab*) p_svt; env_vtab* p_vt = (env_vtab*) p_svt;
p_vt->base.zErrMsg = NULL; p_vt->base.zErrMsg = NULL;
@ -228,7 +228,7 @@ vt_update(sqlite3_vtab* tab,
{ {
const char* name const char* name
= (argc > 2 ? (const char*) sqlite3_value_text(argv[2]) : nullptr); = (argc > 2 ? (const char*) sqlite3_value_text(argv[2]) : nullptr);
vtab* p_vt = (vtab*) tab; env_vtab* p_vt = (env_vtab*) tab;
int retval = SQLITE_ERROR; int retval = SQLITE_ERROR;
if (argc != 1 if (argc != 1

@ -429,9 +429,11 @@ install_extra_formats()
} }
} }
struct userdata { struct config_userdata {
explicit userdata(std::vector<lnav::console::user_message>& errors) explicit config_userdata(std::vector<lnav::console::user_message>& errors)
: ud_errors(errors){}; : ud_errors(errors)
{
}
std::vector<lnav::console::user_message>& ud_errors; std::vector<lnav::console::user_message>& ud_errors;
}; };
@ -440,7 +442,7 @@ static void
config_error_reporter(const yajlpp_parse_context& ypc, config_error_reporter(const yajlpp_parse_context& ypc,
const lnav::console::user_message& msg) const lnav::console::user_message& msg)
{ {
auto* ud = (userdata*) ypc.ypc_userdata; auto* ud = (config_userdata*) ypc.ypc_userdata;
ud->ud_errors.emplace_back(msg); ud->ud_errors.emplace_back(msg);
} }
@ -1334,7 +1336,7 @@ load_config_from(_lnav_config& lconfig,
{ {
yajlpp_parse_context ypc(intern_string::lookup(path.string()), yajlpp_parse_context ypc(intern_string::lookup(path.string()),
&lnav_config_handlers); &lnav_config_handlers);
struct userdata ud(errors); struct config_userdata ud(errors);
auto_fd fd; auto_fd fd;
ypc.ypc_locations = &lnav_config_locations; ypc.ypc_locations = &lnav_config_locations;
@ -1391,7 +1393,7 @@ load_default_config(struct _lnav_config& config_obj,
yajlpp_parse_context ypc_builtin(intern_string::lookup(bsf.get_name()), yajlpp_parse_context ypc_builtin(intern_string::lookup(bsf.get_name()),
&lnav_config_handlers); &lnav_config_handlers);
auto_mem<yajl_handle_t> handle(yajl_free); auto_mem<yajl_handle_t> handle(yajl_free);
struct userdata ud(errors); struct config_userdata ud(errors);
handle = yajl_alloc(&ypc_builtin.ypc_callbacks, nullptr, &ypc_builtin); handle = yajl_alloc(&ypc_builtin.ypc_callbacks, nullptr, &ypc_builtin);
ypc_builtin.ypc_locations = &lnav_config_locations; ypc_builtin.ypc_locations = &lnav_config_locations;

@ -65,7 +65,7 @@ using log_formats_map_t
static auto intern_lifetime = intern_string::get_table_lifetime(); static auto intern_lifetime = intern_string::get_table_lifetime();
static log_formats_map_t LOG_FORMATS; static log_formats_map_t LOG_FORMATS;
struct userdata { struct loader_userdata {
yajlpp_parse_context* ud_parse_context{nullptr}; yajlpp_parse_context* ud_parse_context{nullptr};
ghc::filesystem::path ud_format_path; ghc::filesystem::path ud_format_path;
std::vector<intern_string_t>* ud_format_names{nullptr}; std::vector<intern_string_t>* ud_format_names{nullptr};
@ -73,7 +73,7 @@ struct userdata {
}; };
static external_log_format* static external_log_format*
ensure_format(const yajlpp_provider_context& ypc, userdata* ud) ensure_format(const yajlpp_provider_context& ypc, loader_userdata* ud)
{ {
const intern_string_t name = ypc.get_substr_i(0); const intern_string_t name = ypc.get_substr_i(0);
std::vector<intern_string_t>* formats = ud->ud_format_names; std::vector<intern_string_t>* formats = ud->ud_format_names;
@ -1047,7 +1047,7 @@ static void
format_error_reporter(const yajlpp_parse_context& ypc, format_error_reporter(const yajlpp_parse_context& ypc,
const lnav::console::user_message& msg) const lnav::console::user_message& msg)
{ {
struct userdata* ud = (userdata*) ypc.ypc_userdata; struct loader_userdata* ud = (loader_userdata*) ypc.ypc_userdata;
ud->ud_errors->emplace_back(msg); ud->ud_errors->emplace_back(msg);
} }
@ -1057,7 +1057,7 @@ load_format_file(const ghc::filesystem::path& filename,
std::vector<lnav::console::user_message>& errors) std::vector<lnav::console::user_message>& errors)
{ {
std::vector<intern_string_t> retval; std::vector<intern_string_t> retval;
struct userdata ud; struct loader_userdata ud;
auto_fd fd; auto_fd fd;
log_info("loading formats from file: %s", filename.c_str()); log_info("loading formats from file: %s", filename.c_str());
@ -1156,7 +1156,7 @@ load_formats(const std::vector<ghc::filesystem::path>& extra_paths,
{ {
auto default_source = lnav::paths::dotlnav() / "default"; auto default_source = lnav::paths::dotlnav() / "default";
std::vector<intern_string_t> retval; std::vector<intern_string_t> retval;
struct userdata ud; struct loader_userdata ud;
yajl_handle handle; yajl_handle handle;
write_sample_file(); write_sample_file();

@ -284,7 +284,7 @@ log_vtab_impl::is_valid(log_cursor& lc, logfile_sub_source& lss)
return true; return true;
} }
struct vtab { struct log_vtab {
sqlite3_vtab base; sqlite3_vtab base;
sqlite3* db; sqlite3* db;
textview_curses* tc{nullptr}; textview_curses* tc{nullptr};
@ -321,7 +321,7 @@ vt_create(sqlite3* db,
auto* vm = (log_vtab_manager*) pAux; auto* vm = (log_vtab_manager*) pAux;
int rc = SQLITE_OK; int rc = SQLITE_OK;
/* Allocate the sqlite3_vtab/vtab structure itself */ /* Allocate the sqlite3_vtab/vtab structure itself */
auto p_vt = std::make_unique<vtab>(); auto p_vt = std::make_unique<log_vtab>();
p_vt->db = db; p_vt->db = db;
@ -346,7 +346,7 @@ vt_create(sqlite3* db,
static int static int
vt_destructor(sqlite3_vtab* p_svt) vt_destructor(sqlite3_vtab* p_svt)
{ {
vtab* p_vt = (vtab*) p_svt; log_vtab* p_vt = (log_vtab*) p_svt;
delete p_vt; delete p_vt;
@ -381,7 +381,7 @@ static int vt_next(sqlite3_vtab_cursor* cur);
static int static int
vt_open(sqlite3_vtab* p_svt, sqlite3_vtab_cursor** pp_cursor) vt_open(sqlite3_vtab* p_svt, sqlite3_vtab_cursor** pp_cursor)
{ {
vtab* p_vt = (vtab*) p_svt; log_vtab* p_vt = (log_vtab*) p_svt;
p_vt->base.zErrMsg = nullptr; p_vt->base.zErrMsg = nullptr;
@ -428,7 +428,7 @@ vt_eof(sqlite3_vtab_cursor* cur)
} }
static void static void
populate_indexed_columns(vtab_cursor* vc, vtab* vt) populate_indexed_columns(vtab_cursor* vc, log_vtab* vt)
{ {
if (vc->log_cursor.is_eof() || vc->log_cursor.lc_indexed_columns.empty()) { if (vc->log_cursor.is_eof() || vc->log_cursor.lc_indexed_columns.empty()) {
return; return;
@ -487,7 +487,7 @@ static int
vt_next(sqlite3_vtab_cursor* cur) vt_next(sqlite3_vtab_cursor* cur)
{ {
auto* vc = (vtab_cursor*) cur; auto* vc = (vtab_cursor*) cur;
auto* vt = (vtab*) cur->pVtab; auto* vt = (log_vtab*) cur->pVtab;
auto done = false; auto done = false;
vc->line_values.clear(); vc->line_values.clear();
@ -539,7 +539,7 @@ static int
vt_next_no_rowid(sqlite3_vtab_cursor* cur) vt_next_no_rowid(sqlite3_vtab_cursor* cur)
{ {
auto* vc = (vtab_cursor*) cur; auto* vc = (vtab_cursor*) cur;
auto* vt = (vtab*) cur->pVtab; auto* vt = (log_vtab*) cur->pVtab;
auto done = false; auto done = false;
vc->line_values.lvv_values.clear(); vc->line_values.lvv_values.clear();
@ -595,7 +595,7 @@ static int
vt_column(sqlite3_vtab_cursor* cur, sqlite3_context* ctx, int col) vt_column(sqlite3_vtab_cursor* cur, sqlite3_context* ctx, int col)
{ {
auto* vc = (vtab_cursor*) cur; auto* vc = (vtab_cursor*) cur;
auto* vt = (vtab*) cur->pVtab; auto* vt = (log_vtab*) cur->pVtab;
#ifdef DEBUG_INDEXING #ifdef DEBUG_INDEXING
log_debug("vt_column(%s, %d:%d)", log_debug("vt_column(%s, %d:%d)",
@ -1271,7 +1271,7 @@ vt_filter(sqlite3_vtab_cursor* p_vtc,
sqlite3_value** argv) sqlite3_value** argv)
{ {
auto* p_cur = (vtab_cursor*) p_vtc; auto* p_cur = (vtab_cursor*) p_vtc;
auto* vt = (vtab*) p_vtc->pVtab; auto* vt = (log_vtab*) p_vtc->pVtab;
sqlite3_index_info::sqlite3_index_constraint* index = nullptr; sqlite3_index_info::sqlite3_index_constraint* index = nullptr;
if (idxStr) { if (idxStr) {
@ -1707,7 +1707,7 @@ vt_best_index(sqlite3_vtab* tab, sqlite3_index_info* p_info)
std::vector<sqlite3_index_info::sqlite3_index_constraint> indexes; std::vector<sqlite3_index_info::sqlite3_index_constraint> indexes;
std::vector<std::string> index_desc; std::vector<std::string> index_desc;
int argvInUse = 0; int argvInUse = 0;
auto* vt = (vtab*) tab; auto* vt = (log_vtab*) tab;
log_info("vt_best_index(%s, nConstraint=%d)", log_info("vt_best_index(%s, nConstraint=%d)",
vt->vi->get_name().get(), vt->vi->get_name().get(),
@ -1900,7 +1900,7 @@ vt_update(sqlite3_vtab* tab,
sqlite3_value** argv, sqlite3_value** argv,
sqlite_int64* rowid_out) sqlite_int64* rowid_out)
{ {
vtab* vt = (vtab*) tab; auto* vt = (log_vtab*) tab;
int retval = SQLITE_READONLY; int retval = SQLITE_READONLY;
if (argc > 1 && sqlite3_value_type(argv[0]) != SQLITE_NULL if (argc > 1 && sqlite3_value_type(argv[0]) != SQLITE_NULL

@ -52,7 +52,7 @@ CREATE TABLE lnav_static_files (
); );
)"; )";
struct vtab { struct static_file_vtab {
sqlite3_vtab base; sqlite3_vtab base;
sqlite3* db; sqlite3* db;
}; };
@ -77,10 +77,10 @@ sfvt_create(sqlite3* db,
sqlite3_vtab** pp_vt, sqlite3_vtab** pp_vt,
char** pzErr) char** pzErr)
{ {
vtab* p_vt; static_file_vtab* p_vt;
/* Allocate the sqlite3_vtab/vtab structure itself */ /* Allocate the sqlite3_vtab/vtab structure itself */
p_vt = (vtab*) sqlite3_malloc(sizeof(*p_vt)); p_vt = (static_file_vtab*) sqlite3_malloc(sizeof(*p_vt));
if (p_vt == nullptr) { if (p_vt == nullptr) {
return SQLITE_NOMEM; return SQLITE_NOMEM;
@ -99,7 +99,7 @@ sfvt_create(sqlite3* db,
static int static int
sfvt_destructor(sqlite3_vtab* p_svt) sfvt_destructor(sqlite3_vtab* p_svt)
{ {
vtab* p_vt = (vtab*) p_svt; static_file_vtab* p_vt = (static_file_vtab*) p_svt;
/* Free the SQLite structure */ /* Free the SQLite structure */
sqlite3_free(p_vt); sqlite3_free(p_vt);
@ -161,7 +161,7 @@ find_static_files(sf_vtab_cursor* p_cur, const ghc::filesystem::path& dir)
static int static int
sfvt_open(sqlite3_vtab* p_svt, sqlite3_vtab_cursor** pp_cursor) sfvt_open(sqlite3_vtab* p_svt, sqlite3_vtab_cursor** pp_cursor)
{ {
vtab* p_vt = (vtab*) p_svt; static_file_vtab* p_vt = (static_file_vtab*) p_svt;
p_vt->base.zErrMsg = NULL; p_vt->base.zErrMsg = NULL;

Loading…
Cancel
Save