mirror of
https://github.com/XRPLF/rippled.git
synced 2026-08-22 14:50:54 +00:00
refactor: Use std::format instead of boost::format where it fits (#7996)
Co-authored-by: Timur Yalymov <36795566+tyalymov@users.noreply.github.com> Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: Vito Tumas <5780819+Tapanito@users.noreply.github.com> Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
#include <xrpl/basics/Blob.h>
|
||||
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/utility/string_view.hpp>
|
||||
|
||||
#include <array>
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/asio/ip/tcp.hpp>
|
||||
#include <boost/asio/ssl.hpp>
|
||||
#include <boost/format.hpp>
|
||||
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/tls1.h>
|
||||
|
||||
#include <format>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
@@ -38,8 +38,8 @@ public:
|
||||
|
||||
if (ec && sslVerifyDir.empty())
|
||||
{
|
||||
Throw<std::runtime_error>(boost::str(
|
||||
boost::format("Failed to set_default_verify_paths: %s") % ec.message()));
|
||||
Throw<std::runtime_error>(
|
||||
std::format("Failed to set_default_verify_paths: {}", ec.message()));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
if (ec)
|
||||
{
|
||||
Throw<std::runtime_error>(
|
||||
boost::str(boost::format("Failed to add verify path: %s") % ec.message()));
|
||||
std::format("Failed to add verify path: {}", ec.message()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <format>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
@@ -9,9 +12,29 @@ namespace xrpl {
|
||||
|
||||
// These pragmas are built at startup and applied to all database
|
||||
// connections, unless otherwise noted.
|
||||
inline constexpr char const* kCommonDbPragmaJournal{"PRAGMA journal_mode=%s;"};
|
||||
inline constexpr char const* kCommonDbPragmaSync{"PRAGMA synchronous=%s;"};
|
||||
inline constexpr char const* kCommonDbPragmaTemp{"PRAGMA temp_store=%s;"};
|
||||
//
|
||||
// They are exposed as functions rather than as format-string constants so
|
||||
// that the un-substituted template can never reach sqlite: an unrecognized
|
||||
// pragma value is silently ignored, so forgetting to interpolate would
|
||||
// leave the setting at its default instead of failing loudly.
|
||||
[[nodiscard]] inline std::string
|
||||
commonDbPragmaJournal(std::string_view journalMode)
|
||||
{
|
||||
return std::format("PRAGMA journal_mode={};", journalMode);
|
||||
}
|
||||
|
||||
[[nodiscard]] inline std::string
|
||||
commonDbPragmaSync(std::string_view synchronous)
|
||||
{
|
||||
return std::format("PRAGMA synchronous={};", synchronous);
|
||||
}
|
||||
|
||||
[[nodiscard]] inline std::string
|
||||
commonDbPragmaTemp(std::string_view tempStore)
|
||||
{
|
||||
return std::format("PRAGMA temp_store={};", tempStore);
|
||||
}
|
||||
|
||||
// A warning will be logged if any lower-safety sqlite tuning settings
|
||||
// are used and at least this much ledger history is configured. This
|
||||
// includes full history nodes. This is because such a large amount of
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
#include <xrpl/rdb/DatabaseCon.h>
|
||||
#include <xrpl/server/Manifest.h>
|
||||
|
||||
// boost::optional (not std::optional) appears in the declarations below,
|
||||
// because SOCI's into()/use() bindings only support boost::optional.
|
||||
#include <boost/optional/optional.hpp>
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
Reference in New Issue
Block a user