db/update/Queue: add noexcept

This commit is contained in:
Max Kellermann 2019-09-01 13:55:17 +02:00
parent 366de8773c
commit 2bb5030f70
2 changed files with 13 additions and 13 deletions

View File

@ -21,7 +21,7 @@
bool bool
UpdateQueue::Push(SimpleDatabase &db, Storage &storage, 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) if (update_queue.size() >= MAX_UPDATE_QUEUE_SIZE)
return false; return false;
@ -31,7 +31,7 @@ UpdateQueue::Push(SimpleDatabase &db, Storage &storage,
} }
UpdateQueueItem UpdateQueueItem
UpdateQueue::Pop() UpdateQueue::Pop() noexcept
{ {
if (update_queue.empty()) if (update_queue.empty())
return UpdateQueueItem(); return UpdateQueueItem();
@ -42,7 +42,7 @@ UpdateQueue::Pop()
} }
void void
UpdateQueue::Erase(SimpleDatabase &db) UpdateQueue::Erase(SimpleDatabase &db) noexcept
{ {
for (auto i = update_queue.begin(), end = update_queue.end(); for (auto i = update_queue.begin(), end = update_queue.end();
i != end;) { i != end;) {
@ -54,7 +54,7 @@ UpdateQueue::Erase(SimpleDatabase &db)
} }
void void
UpdateQueue::Erase(Storage &storage) UpdateQueue::Erase(Storage &storage) noexcept
{ {
for (auto i = update_queue.begin(), end = update_queue.end(); for (auto i = update_queue.begin(), end = update_queue.end();
i != end;) { i != end;) {

View File

@ -36,20 +36,20 @@ struct UpdateQueueItem {
unsigned id; unsigned id;
bool discard; bool discard;
UpdateQueueItem():id(0) {} UpdateQueueItem() noexcept:id(0) {}
UpdateQueueItem(SimpleDatabase &_db, UpdateQueueItem(SimpleDatabase &_db,
Storage &_storage, Storage &_storage,
const char *_path, bool _discard, const char *_path, bool _discard,
unsigned _id) unsigned _id) noexcept
:db(&_db), storage(&_storage), path_utf8(_path), :db(&_db), storage(&_storage), path_utf8(_path),
id(_id), discard(_discard) {} id(_id), discard(_discard) {}
bool IsDefined() const { bool IsDefined() const noexcept {
return id != 0; return id != 0;
} }
void Clear() { void Clear() noexcept {
id = 0; id = 0;
} }
}; };
@ -62,19 +62,19 @@ class UpdateQueue {
public: public:
gcc_nonnull_all gcc_nonnull_all
bool Push(SimpleDatabase &db, Storage &storage, 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(); update_queue.clear();
} }
gcc_nonnull_all gcc_nonnull_all
void Erase(SimpleDatabase &db); void Erase(SimpleDatabase &db) noexcept;
gcc_nonnull_all gcc_nonnull_all
void Erase(Storage &storage); void Erase(Storage &storage) noexcept;
}; };
#endif #endif