Merge bitcoin/bitcoin#26960: refactor: Remove c_str from util/check

fab958290b refactor: Remove c_str from util/check (MarcoFalke)

Pull request description:

  Seems confusing and fragile to require calling code to call `c_str()` when passing a read-only view of a std::string.

  Fix that by using std::string_view, which can be constructed from string literals and std::string.

  Also, remove the now unused `c_str()` from `src/wallet/bdb.cpp`.

ACKs for top commit:
  stickies-v:
    ACK fab958290b
  aureleoules:
    ACK fab958290b
  theStack:
    ACK fab958290b

Tree-SHA512: ae39812c6bb8e2ef095e1b843774af2718f48404cb848c3e43b16d3c22240557d69d54a13a038a4a9c48b3ba0e4523e1f87abdd60f91486092f50fd43c0e8483
This commit is contained in:
MarcoFalke
2023-01-26 09:02:22 +01:00
3 changed files with 10 additions and 7 deletions

View File

@@ -663,7 +663,7 @@ BerkeleyCursor::BerkeleyCursor(BerkeleyDatabase& database)
}
int ret = database.m_db->cursor(nullptr, &m_cursor, 0);
if (ret != 0) {
throw std::runtime_error(STR_INTERNAL_BUG(strprintf("BDB Cursor could not be created. Returned %d", ret).c_str()));
throw std::runtime_error(STR_INTERNAL_BUG(strprintf("BDB Cursor could not be created. Returned %d", ret)));
}
}