diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/utils/barrier.cpp | 5 | ||||
-rw-r--r-- | src/lib/utils/parsing.cpp | 10 | ||||
-rw-r--r-- | src/lib/utils/parsing.h | 6 | ||||
-rw-r--r-- | src/lib/utils/semaphore.cpp | 15 |
4 files changed, 22 insertions, 14 deletions
diff --git a/src/lib/utils/barrier.cpp b/src/lib/utils/barrier.cpp index 3c721d905..ed3878d18 100644 --- a/src/lib/utils/barrier.cpp +++ b/src/lib/utils/barrier.cpp @@ -20,9 +20,10 @@ void Barrier::wait(size_t delta) void Barrier::sync() { std::unique_lock<mutex_type> lock(m_mutex); - --m_value; - if(m_value > 0) + + if(m_value > 1) { + --m_value; const size_t current_syncs = m_syncs; m_cond.wait(lock, [this, ¤t_syncs] { return m_syncs != current_syncs; }); } diff --git a/src/lib/utils/parsing.cpp b/src/lib/utils/parsing.cpp index e0173443f..9517cc673 100644 --- a/src/lib/utils/parsing.cpp +++ b/src/lib/utils/parsing.cpp @@ -13,7 +13,6 @@ #include <botan/loadstor.h> #include <limits> #include <set> -#include <algorithm> namespace Botan { @@ -346,7 +345,14 @@ bool host_wildcard_match(const std::string& issued, const std::string& host) return true; } - if(std::count(issued.begin(), issued.end(), '*') > 1) + size_t stars = 0; + for(char c : issued) + { + if(c == '*') + stars += 1; + } + + if(stars > 1) { return false; } diff --git a/src/lib/utils/parsing.h b/src/lib/utils/parsing.h index dbf5d426a..1cba23bc3 100644 --- a/src/lib/utils/parsing.h +++ b/src/lib/utils/parsing.h @@ -48,7 +48,9 @@ split_on_pred(const std::string& str, /** * Erase characters from a string */ -BOTAN_PUBLIC_API(2,0) std::string erase_chars(const std::string& str, const std::set<char>& chars); +BOTAN_PUBLIC_API(2,0) +BOTAN_DEPRECATED("Unused") +std::string erase_chars(const std::string& str, const std::set<char>& chars); /** * Replace a character in a string @@ -58,6 +60,7 @@ BOTAN_PUBLIC_API(2,0) std::string erase_chars(const std::string& str, const std: * @return str with all instances of from_char replaced by to_char */ BOTAN_PUBLIC_API(2,0) +BOTAN_DEPRECATED("Unused") std::string replace_char(const std::string& str, char from_char, char to_char); @@ -70,6 +73,7 @@ std::string replace_char(const std::string& str, * @return str with all instances of from_chars replaced by to_char */ BOTAN_PUBLIC_API(2,0) +BOTAN_DEPRECATED("Unused") std::string replace_chars(const std::string& str, const std::set<char>& from_chars, char to_char); diff --git a/src/lib/utils/semaphore.cpp b/src/lib/utils/semaphore.cpp index 62c31d3e3..e990ded41 100644 --- a/src/lib/utils/semaphore.cpp +++ b/src/lib/utils/semaphore.cpp @@ -19,9 +19,7 @@ void Semaphore::release(size_t n) { lock_guard_type<mutex_type> lock(m_mutex); - ++m_value; - - if(m_value <= 0) + if(m_value++ < 0) { ++m_wakeups; m_cond.notify_one(); @@ -32,12 +30,11 @@ void Semaphore::release(size_t n) void Semaphore::acquire() { std::unique_lock<mutex_type> lock(m_mutex); - --m_value; - if(m_value < 0) - { - m_cond.wait(lock, [this] { return m_wakeups > 0; }); - --m_wakeups; - } + if(m_value-- <= 0) + { + m_cond.wait(lock, [this] { return m_wakeups > 0; }); + --m_wakeups; + } } } |