From 2125e3ed5708898f18da21a33ddd7b4d3ea9c41e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 20 Feb 2019 20:39:49 +0100 Subject: [PATCH] db/simple/Directory: add `noexcept` --- src/db/plugins/simple/Directory.cxx | 12 ++++++------ src/db/plugins/simple/Directory.hxx | 18 +++++++++--------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/db/plugins/simple/Directory.cxx b/src/db/plugins/simple/Directory.cxx index 5a8cd1d9e..8e6ad02aa 100644 --- a/src/db/plugins/simple/Directory.cxx +++ b/src/db/plugins/simple/Directory.cxx @@ -1,5 +1,5 @@ /* - * Copyright 2003-2018 The Music Player Daemon Project + * Copyright 2003-2019 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -37,13 +37,13 @@ #include #include -Directory::Directory(std::string &&_path_utf8, Directory *_parent) +Directory::Directory(std::string &&_path_utf8, Directory *_parent) noexcept :parent(_parent), path(std::move(_path_utf8)) { } -Directory::~Directory() +Directory::~Directory() noexcept { delete mounted_database; @@ -52,7 +52,7 @@ Directory::~Directory() } void -Directory::Delete() +Directory::Delete() noexcept { assert(holding_db_lock()); assert(parent != nullptr); @@ -70,7 +70,7 @@ Directory::GetName() const noexcept } Directory * -Directory::CreateChild(const char *name_utf8) +Directory::CreateChild(const char *name_utf8) noexcept { assert(holding_db_lock()); assert(name_utf8 != nullptr); @@ -160,7 +160,7 @@ Directory::LookupDirectory(const char *uri) noexcept } void -Directory::AddSong(Song *song) +Directory::AddSong(Song *song) noexcept { assert(holding_db_lock()); assert(song != nullptr); diff --git a/src/db/plugins/simple/Directory.hxx b/src/db/plugins/simple/Directory.hxx index 76f56b773..b8d9813b3 100644 --- a/src/db/plugins/simple/Directory.hxx +++ b/src/db/plugins/simple/Directory.hxx @@ -1,5 +1,5 @@ /* - * Copyright 2003-2018 The Music Player Daemon Project + * Copyright 2003-2019 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -99,18 +99,18 @@ struct Directory { Database *mounted_database = nullptr; public: - Directory(std::string &&_path_utf8, Directory *_parent); - ~Directory(); + Directory(std::string &&_path_utf8, Directory *_parent) noexcept; + ~Directory() noexcept; /** * Create a new root #Directory object. */ gcc_malloc gcc_returns_nonnull - static Directory *NewRoot() { + static Directory *NewRoot() noexcept { return new Directory(std::string(), nullptr); } - bool IsMount() const { + bool IsMount() const noexcept { return mounted_database != nullptr; } @@ -120,7 +120,7 @@ public: * * Caller must lock the #db_mutex. */ - void Delete(); + void Delete() noexcept; /** * Create a new #Directory object as a child of the given one. @@ -129,7 +129,7 @@ public: * * @param name_utf8 the UTF-8 encoded name of the new sub directory */ - Directory *CreateChild(const char *name_utf8); + Directory *CreateChild(const char *name_utf8) noexcept; /** * Caller must lock the #db_mutex. @@ -149,7 +149,7 @@ public: * * Caller must lock the #db_mutex. */ - Directory *MakeChild(const char *name_utf8) { + Directory *MakeChild(const char *name_utf8) noexcept { Directory *child = FindChild(name_utf8); if (child == nullptr) child = CreateChild(name_utf8); @@ -242,7 +242,7 @@ public: * Add a song object to this directory. Its "parent" attribute must * be set already. */ - void AddSong(Song *song); + void AddSong(Song *song) noexcept; /** * Remove a song object from this directory (which effectively