As suggested by clang-tidy
(cppcoreguidelines-prefer-member-initializer).
-// 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.
//
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)
-// 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.
//
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;