Temporarily switch to boost::regex
In combination with musl, parser crashed. glibc fine. Could not pinpoint down the exact reason mainly due to time constraints. Strange, in both cases actually libstdc++ is used, so this is very odd.
Tá an tiomantas seo le fáil i:
14
utils.cpp
14
utils.cpp
@ -24,8 +24,10 @@ SOFTWARE.
|
||||
#include <map>
|
||||
#include <cstdlib>
|
||||
#include <fstream>
|
||||
#include <boost/regex.hpp>
|
||||
#include "logger.h"
|
||||
#include "utils.h"
|
||||
|
||||
// TODO: instead of returning vector maybe provide an iterator version too.
|
||||
|
||||
// TODO: % may not be necessary (was in C version just to be sure against format string attacks
|
||||
@ -133,16 +135,16 @@ std::string utils::readCompleteFile(std::string_view filepath)
|
||||
return content;
|
||||
}
|
||||
|
||||
std::string utils::regex_callback_replacer(std::regex regex, const std::string &input,
|
||||
std::function<std::string(std::smatch &)> callback)
|
||||
std::string utils::regex_callback_replacer(boost::regex regex, const std::string &input,
|
||||
std::function<std::string(boost::smatch &)> callback)
|
||||
{
|
||||
std::string result;
|
||||
auto tagsbegin = std::sregex_iterator(input.begin(), input.end(), regex);
|
||||
auto tagsend = std::sregex_iterator();
|
||||
auto tagsbegin = boost::sregex_iterator(input.begin(), input.end(), regex);
|
||||
auto tagsend = boost::sregex_iterator();
|
||||
auto matchbegin = 0;
|
||||
for(std::sregex_iterator i = tagsbegin; i != tagsend; ++i)
|
||||
for(boost::sregex_iterator i = tagsbegin; i != tagsend; ++i)
|
||||
{
|
||||
std::smatch match = *i;
|
||||
boost::smatch match = *i;
|
||||
|
||||
auto matchlength = match.length(0);
|
||||
auto matchpos = match.position();
|
||||
|
Tagairt in Eagrán Nua
Cuir bac ar úsáideoir