From 0af8bb7b3f924ac3f3bd015f2e5277f46598bef4 Mon Sep 17 00:00:00 2001 From: Nguyễn Gia Phong Date: Thu, 28 Nov 2024 18:05:55 +0900 Subject: Unuse Boost's string split Its header causes some odd templating error. --- src/aflrun.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/aflrun.cpp') diff --git a/src/aflrun.cpp b/src/aflrun.cpp index 5cb1c61d..b23c9e02 100644 --- a/src/aflrun.cpp +++ b/src/aflrun.cpp @@ -1,6 +1,5 @@ #include "aflrun.h" -#include #include #include #include @@ -354,17 +353,22 @@ AFLRunConfig::loaders( }}, {"unite_ratio", [](AFLRunConfig* config, const string& val) { // Format: "cov,ctx,pro,tgt" - vector ratios; - bo::split(ratios, val, [](char c) -> bool { return c == ','; }); - if (ratios.size() != 4) - throw string("Invalid 'unite_ratio'"); + std::string::size_type begin = 0; for (size_t i = 0; i < 4; ++i) { - double r = stod(ratios[i]); + const auto end = val.find(',', begin); + if (i < 3 && end == std::string::npos) + throw string("Invalid 'unite_ratio'"); + const auto count = (end == std::string::npos) ? + end : (end - begin); + begin = end; + const auto r = stod(val.substr(begin, count)); if (isnan(r) || isinf(r) || r < 0) throw string("Invalid 'unite_ratio'"); config->unite_ratio[i] = r; } + if (begin != std::string::npos) + throw string("Invalid 'unite_ratio'"); }}, {"single_supp_thr", [](AFLRunConfig* config, const string& val) { // If true, we only use LHS as support count threshold -- cgit 1.4.1