Commit 7fe49cf2 authored by Rosen Penev's avatar Rosen Penev Committed by Max Kellermann

[clang-tidy] use default member init

Found with modernize-use-default-member-init Signed-off-by: 's avatarRosen Penev <rosenp@gmail.com>
parent d2115e90
...@@ -31,11 +31,11 @@ ...@@ -31,11 +31,11 @@
#include <map> #include <map>
struct SearchStats { struct SearchStats {
unsigned n_songs; unsigned n_songs{0};
std::chrono::duration<std::uint64_t, SongTime::period> total_duration; std::chrono::duration<std::uint64_t, SongTime::period> total_duration;
constexpr SearchStats() constexpr SearchStats()
:n_songs(0), total_duration(0) {} : total_duration(0) {}
}; };
class TagCountMap : public std::map<std::string, SearchStats> { class TagCountMap : public std::map<std::string, SearchStats> {
......
...@@ -79,8 +79,8 @@ inline SimpleDatabase::SimpleDatabase(AllocatedPath &&_path, ...@@ -79,8 +79,8 @@ inline SimpleDatabase::SimpleDatabase(AllocatedPath &&_path,
#ifdef ENABLE_ZLIB #ifdef ENABLE_ZLIB
compress(_compress), compress(_compress),
#endif #endif
cache_path(nullptr), cache_path(nullptr)
prefixed_light_song(nullptr) { {
} }
DatabasePtr DatabasePtr
......
...@@ -56,9 +56,9 @@ class PasswdEntry ...@@ -56,9 +56,9 @@ class PasswdEntry
passwd pw; passwd pw;
#endif #endif
passwd *result; passwd *result{nullptr};
public: public:
PasswdEntry() : result(nullptr) { } PasswdEntry() = default;
bool ReadByName(const char *name) { bool ReadByName(const char *name) {
#ifdef HAVE_GETPWNAM_R #ifdef HAVE_GETPWNAM_R
......
...@@ -40,7 +40,7 @@ struct AsxParser { ...@@ -40,7 +40,7 @@ struct AsxParser {
*/ */
enum { enum {
ROOT, ENTRY, ROOT, ENTRY,
} state; } state{ROOT};
/** /**
* The current tag within the "entry" element. This is only * The current tag within the "entry" element. This is only
...@@ -56,8 +56,7 @@ struct AsxParser { ...@@ -56,8 +56,7 @@ struct AsxParser {
TagBuilder tag_builder; TagBuilder tag_builder;
AsxParser() AsxParser() = default;
:state(ROOT) {}
}; };
......
...@@ -57,9 +57,9 @@ ParsePls(TextInputStream &is, std::forward_list<DetachedSong> &songs) ...@@ -57,9 +57,9 @@ ParsePls(TextInputStream &is, std::forward_list<DetachedSong> &songs)
struct Entry { struct Entry {
std::string file, title; std::string file, title;
int length; int length{-1};
Entry():length(-1) {} Entry() = default;
}; };
static constexpr unsigned MAX_ENTRIES = 65536; static constexpr unsigned MAX_ENTRIES = 65536;
......
...@@ -40,7 +40,7 @@ struct RssParser { ...@@ -40,7 +40,7 @@ struct RssParser {
*/ */
enum { enum {
ROOT, ITEM, ROOT, ITEM,
} state; } state{ROOT};
/** /**
* The current tag within the "entry" element. This is only * The current tag within the "entry" element. This is only
...@@ -57,8 +57,7 @@ struct RssParser { ...@@ -57,8 +57,7 @@ struct RssParser {
TagBuilder tag_builder; TagBuilder tag_builder;
RssParser() RssParser() = default;
:state(ROOT) {}
}; };
static void XMLCALL static void XMLCALL
......
...@@ -42,8 +42,7 @@ Tag::Clear() noexcept ...@@ -42,8 +42,7 @@ Tag::Clear() noexcept
Tag::Tag(const Tag &other) noexcept Tag::Tag(const Tag &other) noexcept
:duration(other.duration), has_playlist(other.has_playlist), :duration(other.duration), has_playlist(other.has_playlist),
num_items(other.num_items), num_items(other.num_items)
items(nullptr)
{ {
if (num_items > 0) { if (num_items > 0) {
items = new TagItem *[num_items]; items = new TagItem *[num_items];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment