From 9abfacf182ed4c6aa5d8e53991c67ce5ec68a5f4 Mon Sep 17 00:00:00 2001 From: Dean Lee Date: Wed, 27 Jan 2021 19:10:03 +0800 Subject: [PATCH] util.h: re-indent function string_format and use const std::string & for read_file (#19931) old-commit-hash: 316f475544f4c28808933b593616da1080429e6d --- selfdrive/common/util.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/selfdrive/common/util.h b/selfdrive/common/util.h index 4edc15cd4c..adfcb4b91c 100644 --- a/selfdrive/common/util.h +++ b/selfdrive/common/util.h @@ -38,15 +38,15 @@ inline bool starts_with(const std::string &s, const std::string &prefix) { return s.compare(0, prefix.size(), prefix) == 0; } -template -inline std::string string_format( const std::string& format, Args ... args ) { - size_t size = snprintf( nullptr, 0, format.c_str(), args ... ) + 1; - std::unique_ptr buf( new char[ size ] ); - snprintf( buf.get(), size, format.c_str(), args ... ); - return std::string( buf.get(), buf.get() + size - 1 ); +template +inline std::string string_format(const std::string& format, Args... args) { + size_t size = snprintf(nullptr, 0, format.c_str(), args...) + 1; + std::unique_ptr buf(new char[size]); + snprintf(buf.get(), size, format.c_str(), args...); + return std::string(buf.get(), buf.get() + size - 1); } -inline std::string read_file(std::string fn) { +inline std::string read_file(const std::string &fn) { std::ifstream t(fn); std::stringstream buffer; buffer << t.rdbuf();