From a96e6136833e6fa30f798f3ed64809f4a3e83aba Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Thu, 10 Mar 2022 12:02:22 -0800 Subject: [PATCH 1/2] prefer .empty() to .size()==0 See https://clang.llvm.org/extra/clang-tidy/checks/readability-container-size-empty.html --- src/DbColumn.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DbColumn.cpp b/src/DbColumn.cpp index 575163728..911e5feee 100644 --- a/src/DbColumn.cpp +++ b/src/DbColumn.cpp @@ -50,7 +50,7 @@ void DbColumn::warn_type_conflicts(const String& name) const { my_data_types_seen.erase(DT_BOOL); my_data_types_seen.erase(dt); - if (my_data_types_seen.size() == 0) return; + if (my_data_types_seen.empty()) return; String name_utf8 = name; name_utf8.set_encoding(CE_UTF8); From f6a6a68ab79fcb5957cb0ee4e528a979ccde58ff Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Thu, 10 Mar 2022 12:03:40 -0800 Subject: [PATCH 2/2] also use w/ ternary operator --- src/DbConnection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DbConnection.cpp b/src/DbConnection.cpp index 39aa38f45..291aaf12b 100644 --- a/src/DbConnection.cpp +++ b/src/DbConnection.cpp @@ -8,7 +8,7 @@ DbConnection::DbConnection(const std::string& path, const bool allow_ext, const busy_callback_(NULL) { // Get the underlying database connection - int rc = sqlite3_open_v2(path.c_str(), &pConn_, flags, vfs.size() ? vfs.c_str() : NULL); + int rc = sqlite3_open_v2(path.c_str(), &pConn_, flags, vfs.empty() ? NULL : vfs.c_str()); if (rc != SQLITE_OK) { stop("Could not connect to database:\n%s", getException()); }