From 2bb5030f706ad8c7a9563bf3b7f4a0cdb888077f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 1 Sep 2019 13:55:17 +0200 Subject: [PATCH] db/update/Queue: add `noexcept` --- src/db/update/Queue.cxx | 8 ++++---- src/db/update/Queue.hxx | 18 +++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/db/update/Queue.cxx b/src/db/update/Queue.cxx index f2729bf5f..262e2f2a6 100644 --- a/src/db/update/Queue.cxx +++ b/src/db/update/Queue.cxx @@ -21,7 +21,7 @@ bool UpdateQueue::Push(SimpleDatabase &db, Storage &storage, - const char *path, bool discard, unsigned id) + const char *path, bool discard, unsigned id) noexcept { if (update_queue.size() >= MAX_UPDATE_QUEUE_SIZE) return false; @@ -31,7 +31,7 @@ UpdateQueue::Push(SimpleDatabase &db, Storage &storage, } UpdateQueueItem -UpdateQueue::Pop() +UpdateQueue::Pop() noexcept { if (update_queue.empty()) return UpdateQueueItem(); @@ -42,7 +42,7 @@ UpdateQueue::Pop() } void -UpdateQueue::Erase(SimpleDatabase &db) +UpdateQueue::Erase(SimpleDatabase &db) noexcept { for (auto i = update_queue.begin(), end = update_queue.end(); i != end;) { @@ -54,7 +54,7 @@ UpdateQueue::Erase(SimpleDatabase &db) } void -UpdateQueue::Erase(Storage &storage) +UpdateQueue::Erase(Storage &storage) noexcept { for (auto i = update_queue.begin(), end = update_queue.end(); i != end;) { diff --git a/src/db/update/Queue.hxx b/src/db/update/Queue.hxx index d48e649d3..869f31efc 100644 --- a/src/db/update/Queue.hxx +++ b/src/db/update/Queue.hxx @@ -36,20 +36,20 @@ struct UpdateQueueItem { unsigned id; bool discard; - UpdateQueueItem():id(0) {} + UpdateQueueItem() noexcept:id(0) {} UpdateQueueItem(SimpleDatabase &_db, Storage &_storage, const char *_path, bool _discard, - unsigned _id) + unsigned _id) noexcept :db(&_db), storage(&_storage), path_utf8(_path), id(_id), discard(_discard) {} - bool IsDefined() const { + bool IsDefined() const noexcept { return id != 0; } - void Clear() { + void Clear() noexcept { id = 0; } }; @@ -62,19 +62,19 @@ class UpdateQueue { public: gcc_nonnull_all bool Push(SimpleDatabase &db, Storage &storage, - const char *path, bool discard, unsigned id); + const char *path, bool discard, unsigned id) noexcept; - UpdateQueueItem Pop(); + UpdateQueueItem Pop() noexcept; - void Clear() { + void Clear() noexcept { update_queue.clear(); } gcc_nonnull_all - void Erase(SimpleDatabase &db); + void Erase(SimpleDatabase &db) noexcept; gcc_nonnull_all - void Erase(Storage &storage); + void Erase(Storage &storage) noexcept; }; #endif