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

Method ensureAvailable

bolt/common/memory/HashStringAllocator.cpp:553–567  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

551}
552
553void HashStringAllocator::ensureAvailable(int32_t bytes, Position& position) {
554 if (available(position) >= bytes) {
555 return;
556 }
557
558 ByteOutputStream stream(this);
559 extendWrite(position, stream);
560 static char data[128];
561 while (bytes) {
562 auto written = std::min<size_t>(bytes, sizeof(data));
563 stream.append(folly::StringPiece(data, written));
564 bytes -= written;
565 }
566 position = finishWrite(stream, 0).first;
567}
568
569inline bool HashStringAllocator::storeStringFast(
570 const char* bytes,

Callers 2

prepareAppendMethod · 0.80
TEST_FFunction · 0.80

Calls 1

appendMethod · 0.45

Tested by 1

TEST_FFunction · 0.64