diff options
author | Max Kellermann <max@musicpd.org> | 2017-05-08 14:44:49 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2017-05-08 14:44:49 +0200 |
commit | 71f0ed8b7499011b53f90998ebfbd3250fd80948 (patch) | |
tree | e9c2f66fbef231858f46d878864199d46e6ce21c /src/lib/nfs | |
parent | ac2e4e593d407e41db49fdb9ae2da6bc1557f618 (diff) |
*: add "noexcept" to many, many function prototypes
This eliminates some overhead, because the compiler doesn't need to
consider these functions throwing.
Diffstat (limited to 'src/lib/nfs')
-rw-r--r-- | src/lib/nfs/Base.cxx | 2 | ||||
-rw-r--r-- | src/lib/nfs/Base.hxx | 2 | ||||
-rw-r--r-- | src/lib/nfs/Cancellable.hxx | 14 | ||||
-rw-r--r-- | src/lib/nfs/Connection.hxx | 2 | ||||
-rw-r--r-- | src/lib/nfs/Glue.cxx | 2 | ||||
-rw-r--r-- | src/lib/nfs/Glue.hxx | 2 | ||||
-rw-r--r-- | src/lib/nfs/Manager.cxx | 8 | ||||
-rw-r--r-- | src/lib/nfs/Manager.hxx | 8 |
8 files changed, 20 insertions, 20 deletions
diff --git a/src/lib/nfs/Base.cxx b/src/lib/nfs/Base.cxx index 0a9f4335c..5e67cb5f4 100644 --- a/src/lib/nfs/Base.cxx +++ b/src/lib/nfs/Base.cxx @@ -46,7 +46,7 @@ nfs_set_base(const char *server, const char *export_name) } const char * -nfs_check_base(const char *server, const char *path) +nfs_check_base(const char *server, const char *path) noexcept { assert(server != nullptr); assert(path != nullptr); diff --git a/src/lib/nfs/Base.hxx b/src/lib/nfs/Base.hxx index 2ca15929d..78d25da72 100644 --- a/src/lib/nfs/Base.hxx +++ b/src/lib/nfs/Base.hxx @@ -41,6 +41,6 @@ nfs_set_base(const char *server, const char *export_name); */ gcc_pure const char * -nfs_check_base(const char *server, const char *path); +nfs_check_base(const char *server, const char *path) noexcept; #endif diff --git a/src/lib/nfs/Cancellable.hxx b/src/lib/nfs/Cancellable.hxx index 7c2ccd71a..89635bec7 100644 --- a/src/lib/nfs/Cancellable.hxx +++ b/src/lib/nfs/Cancellable.hxx @@ -91,29 +91,29 @@ private: }; gcc_pure - iterator Find(reference_type p) { + iterator Find(reference_type p) noexcept { return std::find_if(list.begin(), list.end(), MatchPointer(p)); } gcc_pure - const_iterator Find(const_reference_type p) const { + const_iterator Find(const_reference_type p) const noexcept { return std::find_if(list.begin(), list.end(), MatchPointer(p)); } gcc_pure - iterator Find(CT &c) { + iterator Find(CT &c) noexcept { return list.iterator_to(c); } gcc_pure - const_iterator Find(const CT &c) const { + const_iterator Find(const CT &c) const noexcept { return list.iterator_to(c); } public: #ifndef NDEBUG gcc_pure - bool IsEmpty() const { + bool IsEmpty() const noexcept { for (const auto &c : list) if (!c.IsCancelled()) return false; @@ -123,7 +123,7 @@ public: #endif gcc_pure - bool Contains(const_reference_type p) const { + bool Contains(const_reference_type p) const noexcept { return Find(p) != list.end(); } @@ -151,7 +151,7 @@ public: i->Cancel(); } - CT &Get(reference_type p) { + CT &Get(reference_type p) noexcept { auto i = Find(p); assert(i != list.end()); diff --git a/src/lib/nfs/Connection.hxx b/src/lib/nfs/Connection.hxx index ec858e177..a752535e0 100644 --- a/src/lib/nfs/Connection.hxx +++ b/src/lib/nfs/Connection.hxx @@ -135,7 +135,7 @@ class NfsConnection : SocketMonitor, TimeoutMonitor, DeferredMonitor { public: gcc_nonnull_all NfsConnection(EventLoop &_loop, - const char *_server, const char *_export_name) + const char *_server, const char *_export_name) noexcept :SocketMonitor(_loop), TimeoutMonitor(_loop), DeferredMonitor(_loop), server(_server), export_name(_export_name), diff --git a/src/lib/nfs/Glue.cxx b/src/lib/nfs/Glue.cxx index 173f4b333..abcb06f1c 100644 --- a/src/lib/nfs/Glue.cxx +++ b/src/lib/nfs/Glue.cxx @@ -50,7 +50,7 @@ nfs_finish() } NfsConnection & -nfs_get_connection(const char *server, const char *export_name) +nfs_get_connection(const char *server, const char *export_name) noexcept { assert(in_use > 0); assert(io_thread_inside()); diff --git a/src/lib/nfs/Glue.hxx b/src/lib/nfs/Glue.hxx index 81b56ba64..3fc795866 100644 --- a/src/lib/nfs/Glue.hxx +++ b/src/lib/nfs/Glue.hxx @@ -33,6 +33,6 @@ nfs_finish(); gcc_pure NfsConnection & -nfs_get_connection(const char *server, const char *export_name); +nfs_get_connection(const char *server, const char *export_name) noexcept; #endif diff --git a/src/lib/nfs/Manager.cxx b/src/lib/nfs/Manager.cxx index d9385782b..89999e44f 100644 --- a/src/lib/nfs/Manager.cxx +++ b/src/lib/nfs/Manager.cxx @@ -38,7 +38,7 @@ NfsManager::ManagedConnection::OnNfsConnectionError(std::exception_ptr &&e) inline bool NfsManager::Compare::operator()(const LookupKey a, - const ManagedConnection &b) const + const ManagedConnection &b) const noexcept { int result = strcmp(a.server, b.GetServer()); if (result != 0) @@ -50,7 +50,7 @@ NfsManager::Compare::operator()(const LookupKey a, inline bool NfsManager::Compare::operator()(const ManagedConnection &a, - const LookupKey b) const + const LookupKey b) const noexcept { int result = strcmp(a.GetServer(), b.server); if (result != 0) @@ -62,7 +62,7 @@ NfsManager::Compare::operator()(const ManagedConnection &a, inline bool NfsManager::Compare::operator()(const ManagedConnection &a, - const ManagedConnection &b) const + const ManagedConnection &b) const noexcept { int result = strcmp(a.GetServer(), b.GetServer()); if (result != 0) @@ -82,7 +82,7 @@ NfsManager::~NfsManager() } NfsConnection & -NfsManager::GetConnection(const char *server, const char *export_name) +NfsManager::GetConnection(const char *server, const char *export_name) noexcept { assert(server != nullptr); assert(export_name != nullptr); diff --git a/src/lib/nfs/Manager.hxx b/src/lib/nfs/Manager.hxx index 6e9099e8f..ade256003 100644 --- a/src/lib/nfs/Manager.hxx +++ b/src/lib/nfs/Manager.hxx @@ -59,15 +59,15 @@ class NfsManager final : IdleMonitor { struct Compare { gcc_pure bool operator()(const LookupKey a, - const ManagedConnection &b) const; + const ManagedConnection &b) const noexcept; gcc_pure bool operator()(const ManagedConnection &a, - const LookupKey b) const; + const LookupKey b) const noexcept; gcc_pure bool operator()(const ManagedConnection &a, - const ManagedConnection &b) const; + const ManagedConnection &b) const noexcept; }; /** @@ -99,7 +99,7 @@ public: gcc_pure NfsConnection &GetConnection(const char *server, - const char *export_name); + const char *export_name) noexcept; private: void ScheduleDelete(ManagedConnection &c) { |