diff --git a/src/util.cpp b/src/util.cpp index 67091e0f..48f92d05 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -49,7 +49,7 @@ namespace util * @param key Object to insert. * @param ttl Time to live in milliseonds. */ - void ttl_set::emplace(const std::string key, uint64_t ttl_milli) + void ttl_set::emplace(const std::string key, const uint64_t ttl_milli) { ttlmap[key] = util::get_epoch_milliseconds() + ttl_milli; } @@ -188,7 +188,7 @@ namespace util } // Provide a safe std::string overload for realpath - std::string realpath(std::string path) + std::string realpath(const std::string &path) { std::array buffer; ::realpath(path.c_str(), buffer.data()); @@ -216,7 +216,7 @@ namespace util } // Kill a process with a signal and wait until it stops running. - int kill_process(const pid_t pid, const bool wait, int signal) + int kill_process(const pid_t pid, const bool wait, const int signal) { if (kill(pid, signal) == -1) { diff --git a/src/util.hpp b/src/util.hpp index 65cbf5f4..e326c9b1 100644 --- a/src/util.hpp +++ b/src/util.hpp @@ -60,7 +60,7 @@ namespace util std::unordered_map ttlmap; public: - void emplace(const std::string key, uint64_t ttl_milli); + void emplace(const std::string key, const uint64_t ttl_milli); void erase(const std::string &key); bool exists(const std::string &key); }; @@ -86,13 +86,13 @@ namespace util int version_compare(const std::string &x, const std::string &y); - std::string realpath(std::string path); + std::string realpath(const std::string &path); void mask_signal(); void unmask_signal(); - int kill_process(const pid_t pid, const bool wait, int signal = SIGINT); + int kill_process(const pid_t pid, const bool wait, const int signal = SIGINT); bool is_dir_exists(std::string_view path);