From c688461e11f085427b2ebfd7227f2837ceb4f17c Mon Sep 17 00:00:00 2001 From: Dean Lee Date: Sun, 24 Jan 2021 05:47:09 +0800 Subject: [PATCH] util.h: use const reference for std::string parameter (#19885) --- selfdrive/common/util.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/selfdrive/common/util.h b/selfdrive/common/util.h index 2797cbd44a..4edc15cd4c 100644 --- a/selfdrive/common/util.h +++ b/selfdrive/common/util.h @@ -34,7 +34,7 @@ int set_core_affinity(int core); namespace util { -inline bool starts_with(std::string s, std::string prefix) { +inline bool starts_with(const std::string &s, const std::string &prefix) { return s.compare(0, prefix.size(), prefix) == 0; } @@ -74,7 +74,7 @@ inline std::string dir_name(std::string const & path) { return path.substr(0, pos); } -inline std::string readlink(std::string path) { +inline std::string readlink(const std::string &path) { char buff[4096]; ssize_t len = ::readlink(path.c_str(), buff, sizeof(buff)-1); if (len != -1) {