*: add "noexcept" to many, many function prototypes

This eliminates some overhead, because the compiler doesn't need to
consider these functions throwing.
This commit is contained in:
Max Kellermann
2017-05-08 14:44:49 +02:00
parent ac2e4e593d
commit 71f0ed8b74
272 changed files with 873 additions and 846 deletions

View File

@@ -134,10 +134,10 @@ public:
* Caller must lock the #db_mutex.
*/
gcc_pure
const Directory *FindChild(const char *name) const;
const Directory *FindChild(const char *name) const noexcept;
gcc_pure
Directory *FindChild(const char *name) {
Directory *FindChild(const char *name) noexcept {
const Directory *cthis = this;
return const_cast<Directory *>(cthis->FindChild(name));
}
@@ -177,10 +177,10 @@ public:
* @return the Directory, or nullptr if none was found
*/
gcc_pure
LookupResult LookupDirectory(const char *uri);
LookupResult LookupDirectory(const char *uri) noexcept;
gcc_pure
bool IsEmpty() const {
bool IsEmpty() const noexcept {
return children.empty() &&
songs.empty() &&
playlists.empty();
@@ -195,13 +195,13 @@ public:
* Returns the base name of the directory.
*/
gcc_pure
const char *GetName() const;
const char *GetName() const noexcept;
/**
* Is this the root directory of the music database?
*/
gcc_pure
bool IsRoot() const {
bool IsRoot() const noexcept {
return parent == nullptr;
}
@@ -229,10 +229,10 @@ public:
* Caller must lock the #db_mutex.
*/
gcc_pure
const Song *FindSong(const char *name_utf8) const;
const Song *FindSong(const char *name_utf8) const noexcept;
gcc_pure
Song *FindSong(const char *name_utf8) {
Song *FindSong(const char *name_utf8) noexcept {
const Directory *cthis = this;
return const_cast<Song *>(cthis->FindSong(name_utf8));
}
@@ -248,19 +248,19 @@ public:
* invalidates the song object, because the "parent" attribute becomes
* stale), but does not free it.
*/
void RemoveSong(Song *song);
void RemoveSong(Song *song) noexcept;
/**
* Caller must lock the #db_mutex.
*/
void PruneEmpty();
void PruneEmpty() noexcept;
/**
* Sort all directory entries recursively.
*
* Caller must lock the #db_mutex.
*/
void Sort();
void Sort() noexcept;
/**
* Caller must lock #db_mutex.
@@ -270,7 +270,7 @@ public:
VisitPlaylist visit_playlist) const;
gcc_pure
LightDirectory Export() const;
LightDirectory Export() const noexcept;
};
#endif