Merge branch 'trunk' into with-sqlite

This commit is contained in:
Maarten L. Hekkelman
2025-12-20 08:53:23 +01:00
2 changed files with 7 additions and 1 deletions

View File

@@ -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)

View File

@@ -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)