MCPcopy Create free account
hub / github.com/catchorg/Catch2 / split

Function split

fuzzing/fuzz_textflow.cpp:20–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18
19template<class Callback>
20void split(const char *Data, size_t Size, Callback callback) {
21
22 using namespace std::literals;
23 constexpr auto sep="\n~~~\n"sv;
24
25 std::string_view remainder(Data,Size);
26 for (;;) {
27 auto pos=remainder.find(sep);
28 if(pos==std::string_view::npos) {
29 //not found. use the remainder and exit
30 callback(remainder);
31 return;
32 } else {
33 //found. invoke callback on the first part, then proceed with the rest.
34 callback(remainder.substr(0,pos));
35 remainder=remainder.substr(pos+sep.size());
36 }
37 }
38}
39
40extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
41

Callers 1

LLVMFuzzerTestOneInputFunction · 0.85

Calls 3

findMethod · 0.45
substrMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected