mirror of
https://github.com/PDB-REDO/libcifpp.git
synced 2026-06-04 13:54:25 +08:00
Merge branch 'trunk' into with-sqlite
This commit is contained in:
@@ -373,7 +373,7 @@ else()
|
||||
endif()
|
||||
|
||||
if(NOT STD_CHARCONV_COMPILING)
|
||||
target_link_libraries(cifpp PUBLIC FastFloat::fast_float)
|
||||
target_link_libraries(cifpp PRIVATE FastFloat::fast_float)
|
||||
endif()
|
||||
|
||||
# if(BUILD_SQLITE_INTERFACE)
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <format>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <mutex>
|
||||
|
||||
// The validator depends on regular expressions. Unfortunately,
|
||||
// the implementation of std::regex in g++ is buggy and crashes
|
||||
@@ -75,6 +76,7 @@ struct regex_impl
|
||||
private:
|
||||
pcre2_code *m_rx = nullptr;
|
||||
pcre2_match_data *m_data = nullptr;
|
||||
mutable std::mutex m_mutex;
|
||||
};
|
||||
|
||||
regex_impl::regex_impl(std::string_view rx)
|
||||
@@ -95,6 +97,8 @@ regex_impl::regex_impl(std::string_view rx)
|
||||
|
||||
regex_impl::~regex_impl()
|
||||
{
|
||||
std::unique_lock lock(m_mutex);
|
||||
|
||||
if (m_data)
|
||||
pcre2_match_data_free(m_data);
|
||||
|
||||
@@ -104,6 +108,8 @@ regex_impl::~regex_impl()
|
||||
|
||||
bool regex_impl::match(std::string_view v) const
|
||||
{
|
||||
std::unique_lock lock(m_mutex);
|
||||
|
||||
bool result = false;
|
||||
|
||||
if (int rc = pcre2_match(m_rx, (PCRE2_SPTR)v.data(), v.length(), 0, 0, m_data, nullptr); rc >= 0)
|
||||
|
||||
Reference in New Issue
Block a user