db/simple/Directory: add noexcept

This commit is contained in:
Max Kellermann 2019-02-20 20:39:49 +01:00
parent 3da7ecfadf
commit 2125e3ed57
2 changed files with 15 additions and 15 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2018 The Music Player Daemon Project * Copyright 2003-2019 The Music Player Daemon Project
* http://www.musicpd.org * http://www.musicpd.org
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -37,13 +37,13 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
Directory::Directory(std::string &&_path_utf8, Directory *_parent) Directory::Directory(std::string &&_path_utf8, Directory *_parent) noexcept
:parent(_parent), :parent(_parent),
path(std::move(_path_utf8)) path(std::move(_path_utf8))
{ {
} }
Directory::~Directory() Directory::~Directory() noexcept
{ {
delete mounted_database; delete mounted_database;
@ -52,7 +52,7 @@ Directory::~Directory()
} }
void void
Directory::Delete() Directory::Delete() noexcept
{ {
assert(holding_db_lock()); assert(holding_db_lock());
assert(parent != nullptr); assert(parent != nullptr);
@ -70,7 +70,7 @@ Directory::GetName() const noexcept
} }
Directory * Directory *
Directory::CreateChild(const char *name_utf8) Directory::CreateChild(const char *name_utf8) noexcept
{ {
assert(holding_db_lock()); assert(holding_db_lock());
assert(name_utf8 != nullptr); assert(name_utf8 != nullptr);
@ -160,7 +160,7 @@ Directory::LookupDirectory(const char *uri) noexcept
} }
void void
Directory::AddSong(Song *song) Directory::AddSong(Song *song) noexcept
{ {
assert(holding_db_lock()); assert(holding_db_lock());
assert(song != nullptr); assert(song != nullptr);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2018 The Music Player Daemon Project * Copyright 2003-2019 The Music Player Daemon Project
* http://www.musicpd.org * http://www.musicpd.org
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -99,18 +99,18 @@ struct Directory {
Database *mounted_database = nullptr; Database *mounted_database = nullptr;
public: public:
Directory(std::string &&_path_utf8, Directory *_parent); Directory(std::string &&_path_utf8, Directory *_parent) noexcept;
~Directory(); ~Directory() noexcept;
/** /**
* Create a new root #Directory object. * Create a new root #Directory object.
*/ */
gcc_malloc gcc_returns_nonnull gcc_malloc gcc_returns_nonnull
static Directory *NewRoot() { static Directory *NewRoot() noexcept {
return new Directory(std::string(), nullptr); return new Directory(std::string(), nullptr);
} }
bool IsMount() const { bool IsMount() const noexcept {
return mounted_database != nullptr; return mounted_database != nullptr;
} }
@ -120,7 +120,7 @@ public:
* *
* Caller must lock the #db_mutex. * Caller must lock the #db_mutex.
*/ */
void Delete(); void Delete() noexcept;
/** /**
* Create a new #Directory object as a child of the given one. * 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 * @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. * Caller must lock the #db_mutex.
@ -149,7 +149,7 @@ public:
* *
* Caller must lock the #db_mutex. * Caller must lock the #db_mutex.
*/ */
Directory *MakeChild(const char *name_utf8) { Directory *MakeChild(const char *name_utf8) noexcept {
Directory *child = FindChild(name_utf8); Directory *child = FindChild(name_utf8);
if (child == nullptr) if (child == nullptr)
child = CreateChild(name_utf8); child = CreateChild(name_utf8);
@ -242,7 +242,7 @@ public:
* Add a song object to this directory. Its "parent" attribute must * Add a song object to this directory. Its "parent" attribute must
* be set already. * be set already.
*/ */
void AddSong(Song *song); void AddSong(Song *song) noexcept;
/** /**
* Remove a song object from this directory (which effectively * Remove a song object from this directory (which effectively