From: Joel Rosdahl Date: Wed, 19 Apr 2023 20:00:38 +0000 (+0200) Subject: refactor: Use constructor member initializer lists X-Git-Tag: v4.8.1~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4d7c6f7d5a73a15d6e6e2cad2ce2907dde14c049;p=thirdparty%2Fccache.git refactor: Use constructor member initializer lists As suggested by clang-tidy (cppcoreguidelines-prefer-member-initializer). --- diff --git a/src/File.hpp b/src/File.hpp index eea2c09c6..5ace57041 100644 --- a/src/File.hpp +++ b/src/File.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2019-2021 Joel Rosdahl and other contributors +// Copyright (C) 2019-2023 Joel Rosdahl and other contributors // // See doc/AUTHORS.adoc for a complete list of contributors. // @@ -46,10 +46,8 @@ private: bool m_owned = false; }; -inline File::File(FILE* const file) +inline File::File(FILE* const file) : m_file(file), m_owned(false) { - m_file = file; - m_owned = false; } inline File::File(const std::string& path, const char* mode) diff --git a/src/Stat.cpp b/src/Stat.cpp index 87b20203c..15293e12b 100644 --- a/src/Stat.cpp +++ b/src/Stat.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2019-2022 Joel Rosdahl and other contributors +// Copyright (C) 2019-2023 Joel Rosdahl and other contributors // // See doc/AUTHORS.adoc for a complete list of contributors. // @@ -206,8 +206,8 @@ win32_lstat(const char* path, Stat::stat_t* st) Stat::Stat(StatFunction stat_function, const std::string& path, Stat::OnError on_error) + : m_path(path) { - m_path = path; int result = stat_function(path.c_str(), &m_stat); if (result == 0) { m_errno = 0;