MCPcopy Create free account
hub / github.com/catboost/catboost / DoReadTo

Method DoReadTo

util/stream/zerocopy.cpp:37–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35IZeroCopyInputFastReadTo::~IZeroCopyInputFastReadTo() = default;
36
37size_t IZeroCopyInputFastReadTo::DoReadTo(TString& st, char ch) {
38 const char* ptr;
39 size_t len = Next(&ptr);
40 if (!len) {
41 return 0;
42 }
43 size_t result = 0;
44 st.clear();
45 do {
46 if (const char* pos = (const char*)memchr(ptr, ch, len)) {
47 size_t bytesRead = (pos - ptr) + 1;
48 if (bytesRead > 1) {
49 st.append(ptr, pos);
50 }
51 Undo(len - bytesRead);
52 result += bytesRead;
53 return result;
54 } else {
55 result += len;
56 st.append(ptr, len);
57 }
58 len = Next(&ptr);
59 } while (len);
60 return result;
61}

Callers

nothing calls this directly

Calls 5

UndoFunction · 0.85
NextFunction · 0.70
memchrFunction · 0.50
clearMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected