diff --git a/src/components/memory.cpp b/src/components/memory.cpp index e118061..dd87532 100644 --- a/src/components/memory.cpp +++ b/src/components/memory.cpp @@ -7,7 +7,7 @@ #include "memory.hpp" bool memory::getProcMem(crow::json::wvalue& ret){ - std::ifstream f (procmempath); + std::ifstream f (PROC_MEM_PATH); std::string line; if(f.is_open()){ while(std::getline(f, line)){ @@ -36,7 +36,7 @@ bool memory::getProcMem(crow::json::wvalue& ret){ } bool memory::getRawProcMem(std::string& ret){ - std::ifstream f (procmempath); + std::ifstream f (PROC_MEM_PATH); std::string line; if(f.is_open()){ while(std::getline(f, line)){ @@ -53,7 +53,7 @@ bool memory::getRawProcMem(std::string& ret){ } bool memory::getEasyMem(crow::json::wvalue& ret){ - std::ifstream f (procmempath); + std::ifstream f (PROC_MEM_PATH); std::string line; if(f.is_open()){ for(int j = 0; j < 3; ++j){ diff --git a/src/components/memory.hpp b/src/components/memory.hpp index 2609f7c..f3eb471 100644 --- a/src/components/memory.hpp +++ b/src/components/memory.hpp @@ -11,7 +11,7 @@ #include #include -constexpr char procmempath[] = "/proc/meminfo"; +constexpr char PROC_MEM_PATH[] = "/proc/meminfo"; namespace memory{ bool getProcMem(crow::json::wvalue&); diff --git a/src/components/state.cpp b/src/components/state.cpp index 5ce4535..b06845d 100644 --- a/src/components/state.cpp +++ b/src/components/state.cpp @@ -7,7 +7,7 @@ #include "state.hpp" bool state::getUptime(crow::json::wvalue& ret){ - std::ifstream f (procuptimepath); + std::ifstream f (PROC_UPTIME_PATH); std::string line; if(f.is_open()){ int space = -1; @@ -34,7 +34,7 @@ bool state::getUptime(crow::json::wvalue& ret){ } bool state::getRawUptime(std::string& ret){ - std::ifstream f (procuptimepath); + std::ifstream f (PROC_UPTIME_PATH); if(f.is_open()){ std::getline(f, ret); ret += '\n'; @@ -48,7 +48,7 @@ bool state::getRawUptime(std::string& ret){ } bool state::getLoadAvg(crow::json::wvalue& ret){ - std::ifstream f (procloadavgpath); + std::ifstream f (PROC_LOADAVG_PATH); std::string line; if(f.is_open()){ int spaces[4]; @@ -78,7 +78,7 @@ bool state::getLoadAvg(crow::json::wvalue& ret){ } bool state::getRawLoadAvg(std::string& ret){ - std::ifstream f (procloadavgpath); + std::ifstream f (PROC_LOADAVG_PATH); if(f.is_open()){ std::getline(f, ret); ret += '\n'; @@ -92,7 +92,7 @@ bool state::getRawLoadAvg(std::string& ret){ } bool state::getHostname(crow::json::wvalue& ret){ - std::ifstream f (prochostnamepath); + std::ifstream f (PROC_HOSTNAME_PATH); std::string line; if(f.is_open()){ std::getline(f, line); @@ -108,7 +108,7 @@ bool state::getHostname(crow::json::wvalue& ret){ } bool state::getRawHostname(std::string& ret){ - std::ifstream f (prochostnamepath); + std::ifstream f (PROC_HOSTNAME_PATH); if(f.is_open()){ std::getline(f, ret); ret += '\n'; diff --git a/src/components/state.hpp b/src/components/state.hpp index 1a17d7a..5b14d40 100644 --- a/src/components/state.hpp +++ b/src/components/state.hpp @@ -11,9 +11,9 @@ #include #include -constexpr char procuptimepath[] = "/proc/uptime"; -constexpr char procloadavgpath[] = "/proc/loadavg"; -constexpr char prochostnamepath[] = "/proc/sys/kernel/hostname"; +constexpr char PROC_UPTIME_PATH[] = "/proc/uptime"; +constexpr char PROC_LOADAVG_PATH[] = "/proc/loadavg"; +constexpr char PROC_HOSTNAME_PATH[] = "/proc/sys/kernel/hostname"; namespace state{ bool getUptime(crow::json::wvalue&);