23#pragma warning(disable : 4786)
24#pragma warning(disable : 4804)
25#pragma warning(disable : 4805)
26#pragma warning(disable : 4717)
35#ifdef HAVE_MALLOPT_ARENA_MAX
44 std::string escaped = arg;
46 return "'" + escaped +
"'";
50#if defined(HAVE_SYSTEM)
51void runCommand(
const std::string &strCommand) {
52 if (strCommand.empty()) {
56 int nErr = ::system(strCommand.c_str());
58 int nErr = ::_wsystem(
59 std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>,
wchar_t>()
60 .from_bytes(strCommand)
64 LogPrintf(
"runCommand error: system(%s) returned %d\n", strCommand,
71#ifdef HAVE_MALLOPT_ARENA_MAX
77 if (
sizeof(
void *) == 4) {
78 mallopt(M_ARENA_MAX, 1);
83#if !defined(WIN32) && !defined(MAC_OSX) && !defined(__FreeBSD__) && \
88 }
catch (
const std::runtime_error &) {
89 setenv(
"LC_ALL",
"C.UTF-8", 1);
93 SetConsoleCP(CP_UTF8);
94 SetConsoleOutputCP(CP_UTF8);
102 int ret = WSAStartup(MAKEWORD(2, 2), &wsadata);
103 if (ret != NO_ERROR || LOBYTE(wsadata.wVersion) != 2 ||
104 HIBYTE(wsadata.wVersion) != 2) {
112 return std::thread::hardware_concurrency();
void ReplaceAll(std::string &in_out, const std::string &search, const std::string &substitute)
const int64_t nStartupTime
int GetNumCores()
Return the number of cores available on the current system.
std::string ShellEscape(const std::string &arg)
int64_t GetTime()
DEPRECATED Use either ClockType::now() or Now<TimePointType>() if a cast is needed.