Make Process::location static.

This commit is contained in:
XMRig 2019-12-22 13:26:06 +07:00
parent c44ae06d54
commit bdf12bca0f
No known key found for this signature in database
GPG key ID: 446A53638BE94409
4 changed files with 13 additions and 7 deletions

View file

@ -127,7 +127,7 @@ private:
return config.release();
}
chain.addFile(process->location(Process::ExeLocation, "config.json"));
chain.addFile(Process::location(Process::ExeLocation, "config.json"));
if (read(chain, config)) {
return config.release();

View file

@ -101,9 +101,9 @@ static int showVersion()
#ifdef XMRIG_FEATURE_HWLOC
static int exportTopology(const Process &process)
static int exportTopology(const Process &)
{
const String path = process.location(Process::ExeLocation, "topology.xml");
const String path = Process::location(Process::ExeLocation, "topology.xml");
hwloc_topology_t topology;
hwloc_topology_init(&topology);

View file

@ -31,7 +31,10 @@
#include "base/tools/Chrono.h"
static size_t location(xmrig::Process::Location location, char *buf, size_t max)
namespace xmrig {
static size_t getLocation(Process::Location location, char *buf, size_t max)
{
using namespace xmrig;
@ -48,6 +51,9 @@ static size_t location(xmrig::Process::Location location, char *buf, size_t max)
}
} // namespace xmrig
xmrig::Process::Process(int argc, char **argv) :
m_arguments(argc, argv)
{
@ -55,12 +61,12 @@ xmrig::Process::Process(int argc, char **argv) :
}
xmrig::String xmrig::Process::location(Location location, const char *fileName) const
xmrig::String xmrig::Process::location(Location location, const char *fileName)
{
constexpr const size_t max = 520;
char *buf = new char[max]();
size_t size = ::location(location, buf, max);
size_t size = getLocation(location, buf, max);
if (size == 0) {
delete [] buf;

View file

@ -48,7 +48,7 @@ public:
Process(int argc, char **argv);
String location(Location location, const char *fileName = nullptr) const;
static String location(Location location, const char *fileName = nullptr);
inline const Arguments &arguments() const { return m_arguments; }