MCPcopy Create free account
hub / github.com/chrxh/alien / buf_find

Method buf_find

external/cpp-httplib/httplib.h:3998–4019  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3996 }
3997
3998 size_t buf_find(const std::string& s) const {
3999 auto c = s.front();
4000
4001 size_t off = buf_spos_;
4002 while (off < buf_epos_) {
4003 auto pos = off;
4004 while (true) {
4005 if (pos == buf_epos_) { return buf_size(); }
4006 if (buf_[pos] == c) { break; }
4007 pos++;
4008 }
4009
4010 auto remaining_size = buf_epos_ - pos;
4011 if (s.size() > remaining_size) { return buf_size(); }
4012
4013 if (start_with(buf_, pos, buf_epos_, s)) { return pos - buf_spos_; }
4014
4015 off = pos + 1;
4016 }
4017
4018 return buf_size();
4019 }
4020
4021 void buf_append(const char* data, size_t n) {
4022 auto remaining_size = buf_size();

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected