mirror of
https://github.com/tstack/lnav.git
synced 2024-09-11 13:05:51 +03:00
parent
b3b8ed7f07
commit
3c36869711
@ -1,6 +1,6 @@
|
||||
|
||||
# aminclude_static.am generated automatically by Autoconf
|
||||
# from AX_AM_MACROS_STATIC on Sun Sep 26 21:58:01 PDT 2021
|
||||
# from AX_AM_MACROS_STATIC on Fri Oct 1 09:22:49 PDT 2021
|
||||
|
||||
|
||||
# Code coverage
|
||||
|
@ -1735,7 +1735,12 @@ static void looper()
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (pollfd_ready(pollfds, STDIN_FILENO)) {
|
||||
auto in_revents = pollfd_revents(pollfds, STDIN_FILENO);
|
||||
|
||||
if (in_revents & (POLLHUP|POLLNVAL)) {
|
||||
log_info("stdin has been closed, exiting...");
|
||||
lnav_data.ld_looping = false;
|
||||
} else if (in_revents & POLLIN) {
|
||||
int ch;
|
||||
|
||||
while ((ch = getch()) != ERR) {
|
||||
|
@ -130,6 +130,18 @@ Result<std::string, std::string> read_file(const ghc::filesystem::path &path);
|
||||
template<typename T>
|
||||
size_t strtonum(T &num_out, const char *data, size_t len);
|
||||
|
||||
inline short pollfd_revents(const std::vector<struct pollfd> &pollfds, int fd) {
|
||||
auto iter = std::find_if(pollfds.begin(), pollfds.end(), [fd](const auto& entry) {
|
||||
return entry.fd == fd;
|
||||
});
|
||||
|
||||
if (iter == pollfds.end()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return iter->revents;
|
||||
}
|
||||
|
||||
inline bool pollfd_ready(const std::vector<struct pollfd> &pollfds, int fd,
|
||||
short events = POLLIN | POLLHUP)
|
||||
{
|
||||
|
@ -280,7 +280,7 @@ static void cleanup_session_data()
|
||||
else {
|
||||
if (remove(front.sfi_path.c_str()) != 0) {
|
||||
log_error(
|
||||
"Unable to remove session file: %s -- %s\n",
|
||||
"Unable to remove session file: %s -- %s",
|
||||
front.sfi_path.c_str(),
|
||||
strerror(errno));
|
||||
}
|
||||
@ -296,7 +296,7 @@ static void cleanup_session_data()
|
||||
|
||||
if (remove(front.sfi_path.c_str()) != 0) {
|
||||
log_error(
|
||||
"Unable to remove session file: %s -- %s\n",
|
||||
"Unable to remove session file: %s -- %s",
|
||||
front.sfi_path.c_str(),
|
||||
strerror(errno));
|
||||
}
|
||||
@ -382,7 +382,7 @@ nonstd::optional<session_pair_t> scan_sessions()
|
||||
|
||||
if (remove(name.c_str()) != 0) {
|
||||
log_error(
|
||||
"Unable to remove session: %s -- %s\n",
|
||||
"Unable to remove session: %s -- %s",
|
||||
name.c_str(),
|
||||
strerror(errno));
|
||||
}
|
||||
@ -415,7 +415,7 @@ void load_time_bookmarks()
|
||||
|
||||
for (const char *upgrade_stmt : UPGRADE_STMTS) {
|
||||
if (sqlite3_exec(db.in(), upgrade_stmt, nullptr, nullptr, errmsg.out()) != SQLITE_OK) {
|
||||
log_error("unable to upgrade bookmark table -- %s\n", errmsg.in());
|
||||
log_error("unable to upgrade bookmark table -- %s", errmsg.in());
|
||||
}
|
||||
}
|
||||
|
||||
@ -604,7 +604,7 @@ void load_time_bookmarks()
|
||||
|
||||
errmsg = sqlite3_errmsg(lnav_data.ld_db);
|
||||
log_error(
|
||||
"bookmark select error: code %d -- %s\n",
|
||||
"bookmark select error: code %d -- %s",
|
||||
rc,
|
||||
errmsg);
|
||||
done = true;
|
||||
@ -624,7 +624,7 @@ void load_time_bookmarks()
|
||||
stmt.out(),
|
||||
nullptr) != SQLITE_OK) {
|
||||
log_error(
|
||||
"could not prepare time_offset select statement -- %s\n",
|
||||
"could not prepare time_offset select statement -- %s",
|
||||
sqlite3_errmsg(db));
|
||||
return;
|
||||
}
|
||||
@ -727,7 +727,7 @@ void load_time_bookmarks()
|
||||
|
||||
errmsg = sqlite3_errmsg(lnav_data.ld_db);
|
||||
log_error(
|
||||
"bookmark select error: code %d -- %s\n",
|
||||
"bookmark select error: code %d -- %s",
|
||||
rc,
|
||||
errmsg);
|
||||
done = true;
|
||||
@ -980,7 +980,7 @@ static void save_user_bookmarks(
|
||||
|
||||
if (meta_iter == bm_meta.end()) {
|
||||
if (sqlite3_bind_text(stmt, 5, "", 0, SQLITE_TRANSIENT) != SQLITE_OK) {
|
||||
log_error("could not bind log hash -- %s\n",
|
||||
log_error("could not bind log hash -- %s",
|
||||
sqlite3_errmsg(db));
|
||||
return;
|
||||
}
|
||||
@ -994,7 +994,7 @@ static void save_user_bookmarks(
|
||||
meta_iter->second.bm_name.c_str(),
|
||||
meta_iter->second.bm_name.length(),
|
||||
SQLITE_TRANSIENT) != SQLITE_OK) {
|
||||
log_error("could not bind part name -- %s\n",
|
||||
log_error("could not bind part name -- %s",
|
||||
sqlite3_errmsg(db));
|
||||
return;
|
||||
}
|
||||
@ -1004,7 +1004,7 @@ static void save_user_bookmarks(
|
||||
meta_iter->second.bm_comment.c_str(),
|
||||
meta_iter->second.bm_comment.length(),
|
||||
SQLITE_TRANSIENT) != SQLITE_OK) {
|
||||
log_error("could not bind comment -- %s\n",
|
||||
log_error("could not bind comment -- %s",
|
||||
sqlite3_errmsg(db));
|
||||
return;
|
||||
}
|
||||
@ -1031,7 +1031,7 @@ static void save_user_bookmarks(
|
||||
tags.c_str(),
|
||||
tags.length(),
|
||||
SQLITE_TRANSIENT) != SQLITE_OK) {
|
||||
log_error("could not bind tags -- %s\n",
|
||||
log_error("could not bind tags -- %s",
|
||||
sqlite3_errmsg(db));
|
||||
return;
|
||||
}
|
||||
@ -1039,7 +1039,7 @@ static void save_user_bookmarks(
|
||||
|
||||
if (sqlite3_step(stmt) != SQLITE_DONE) {
|
||||
log_error(
|
||||
"could not execute bookmark insert statement -- %s\n",
|
||||
"could not execute bookmark insert statement -- %s",
|
||||
sqlite3_errmsg(db));
|
||||
return;
|
||||
}
|
||||
@ -1059,17 +1059,17 @@ static void save_time_bookmarks()
|
||||
auto_mem<sqlite3_stmt> stmt(sqlite3_finalize);
|
||||
|
||||
if (sqlite3_open(db_path.c_str(), db.out()) != SQLITE_OK) {
|
||||
log_error("unable to open bookmark DB -- %s\n", db_path.c_str());
|
||||
log_error("unable to open bookmark DB -- %s", db_path.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if (sqlite3_exec(db.in(), BOOKMARK_TABLE_DEF, nullptr, nullptr, errmsg.out()) != SQLITE_OK) {
|
||||
log_error("unable to make bookmark table -- %s\n", errmsg.in());
|
||||
log_error("unable to make bookmark table -- %s", errmsg.in());
|
||||
return;
|
||||
}
|
||||
|
||||
if (sqlite3_exec(db.in(), "BEGIN TRANSACTION", nullptr, nullptr, errmsg.out()) != SQLITE_OK) {
|
||||
log_error("unable to begin transaction -- %s\n", errmsg.in());
|
||||
log_error("unable to begin transaction -- %s", errmsg.in());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1151,7 +1151,7 @@ static void save_time_bookmarks()
|
||||
stmt.out(),
|
||||
nullptr) != SQLITE_OK) {
|
||||
log_error(
|
||||
"could not prepare bookmark replace statement -- %s\n",
|
||||
"could not prepare bookmark replace statement -- %s",
|
||||
sqlite3_errmsg(db));
|
||||
return;
|
||||
}
|
||||
@ -1179,14 +1179,14 @@ static void save_time_bookmarks()
|
||||
}
|
||||
|
||||
if (sqlite3_bind_null(stmt.in(), 5) != SQLITE_OK) {
|
||||
log_error("could not bind log hash -- %s\n",
|
||||
log_error("could not bind log hash -- %s",
|
||||
sqlite3_errmsg(db.in()));
|
||||
return;
|
||||
}
|
||||
|
||||
if (sqlite3_step(stmt.in()) != SQLITE_DONE) {
|
||||
log_error(
|
||||
"could not execute bookmark insert statement -- %s\n",
|
||||
"could not execute bookmark insert statement -- %s",
|
||||
sqlite3_errmsg(db));
|
||||
return;
|
||||
}
|
||||
@ -1206,7 +1206,7 @@ static void save_time_bookmarks()
|
||||
stmt.out(),
|
||||
NULL) != SQLITE_OK) {
|
||||
log_error(
|
||||
"could not prepare time_offset delete statement -- %s\n",
|
||||
"could not prepare time_offset delete statement -- %s",
|
||||
sqlite3_errmsg(db));
|
||||
return;
|
||||
}
|
||||
@ -1219,7 +1219,7 @@ static void save_time_bookmarks()
|
||||
|
||||
if (sqlite3_step(stmt.in()) != SQLITE_DONE) {
|
||||
log_error(
|
||||
"could not execute bookmark insert statement -- %s\n",
|
||||
"could not execute bookmark insert statement -- %s",
|
||||
sqlite3_errmsg(db));
|
||||
return;
|
||||
}
|
||||
@ -1237,7 +1237,7 @@ static void save_time_bookmarks()
|
||||
stmt.out(),
|
||||
NULL) != SQLITE_OK) {
|
||||
log_error(
|
||||
"could not prepare time_offset replace statement -- %s\n",
|
||||
"could not prepare time_offset replace statement -- %s",
|
||||
sqlite3_errmsg(db));
|
||||
return;
|
||||
}
|
||||
@ -1266,20 +1266,20 @@ static void save_time_bookmarks()
|
||||
}
|
||||
|
||||
if (sqlite3_bind_null(stmt.in(), 5) != SQLITE_OK) {
|
||||
log_error("could not bind log hash -- %s\n",
|
||||
log_error("could not bind log hash -- %s",
|
||||
sqlite3_errmsg(db.in()));
|
||||
return;
|
||||
}
|
||||
|
||||
if (sqlite3_bind_null(stmt.in(), 6) != SQLITE_OK) {
|
||||
log_error("could not bind log hash -- %s\n",
|
||||
log_error("could not bind log hash -- %s",
|
||||
sqlite3_errmsg(db.in()));
|
||||
return;
|
||||
}
|
||||
|
||||
if (sqlite3_step(stmt.in()) != SQLITE_DONE) {
|
||||
log_error(
|
||||
"could not execute bookmark insert statement -- %s\n",
|
||||
"could not execute bookmark insert statement -- %s",
|
||||
sqlite3_errmsg(db));
|
||||
return;
|
||||
}
|
||||
@ -1319,7 +1319,7 @@ static void save_time_bookmarks()
|
||||
|
||||
if (sqlite3_step(stmt.in()) != SQLITE_DONE) {
|
||||
log_error(
|
||||
"could not execute bookmark insert statement -- %s\n",
|
||||
"could not execute bookmark insert statement -- %s",
|
||||
sqlite3_errmsg(db));
|
||||
return;
|
||||
}
|
||||
@ -1328,17 +1328,17 @@ static void save_time_bookmarks()
|
||||
}
|
||||
|
||||
if (sqlite3_exec(db.in(), "COMMIT", nullptr, nullptr, errmsg.out()) != SQLITE_OK) {
|
||||
log_error("unable to begin transaction -- %s\n", errmsg.in());
|
||||
log_error("unable to begin transaction -- %s", errmsg.in());
|
||||
return;
|
||||
}
|
||||
|
||||
if (sqlite3_exec(db.in(), BOOKMARK_LRU_STMT, nullptr, nullptr, errmsg.out()) != SQLITE_OK) {
|
||||
log_error("unable to delete old bookmarks -- %s\n", errmsg.in());
|
||||
log_error("unable to delete old bookmarks -- %s", errmsg.in());
|
||||
return;
|
||||
}
|
||||
|
||||
if (sqlite3_exec(db.in(), NETLOC_LRU_STMT, nullptr, nullptr, errmsg.out()) != SQLITE_OK) {
|
||||
log_error("unable to delete old netlocs -- %s\n", errmsg.in());
|
||||
log_error("unable to delete old netlocs -- %s", errmsg.in());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user