Updated const parameters in util functions.

This commit is contained in:
ravinsp
2020-09-04 12:03:36 +05:30
parent 2fc93d4291
commit 974fe82395
2 changed files with 6 additions and 6 deletions

View File

@@ -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<char, PATH_MAX> 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)
{

View File

@@ -60,7 +60,7 @@ namespace util
std::unordered_map<std::string, uint64_t> 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);