MCPcopy Create free account
hub / github.com/bytedance/bolt / copyMultipartNoInline

Method copyMultipartNoInline

bolt/common/memory/HashStringAllocator.cpp:621–639  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

619}
620
621void HashStringAllocator::copyMultipartNoInline(
622 const StringView& srcStr,
623 char* group,
624 int32_t offset) {
625 const auto numBytes = srcStr.size();
626 if (storeStringFast(srcStr.data(), numBytes, group + offset)) {
627 return;
628 }
629 // Write the string as non-contiguous chunks.
630 ByteOutputStream stream(this, false, false);
631 auto position = newWrite(stream, numBytes);
632 stream.appendStringView(srcStr);
633 finishWrite(stream, 0);
634
635 // The stringView has a pointer to the first byte and the total
636 // size. Read with contiguousString().
637 *reinterpret_cast<StringView*>(group + offset) =
638 StringView(reinterpret_cast<char*>(position.position), numBytes);
639}
640
641std::string HashStringAllocator::toString() const {
642 std::ostringstream out;

Callers

nothing calls this directly

Calls 4

StringViewClass · 0.50
sizeMethod · 0.45
dataMethod · 0.45
appendStringViewMethod · 0.45

Tested by

no test coverage detected