MCPcopy Create free account
hub / github.com/apple/foundationdb / tryReadZeroCopy

Method tryReadZeroCopy

flow/include/flow/ObjectSerializer.h:48–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46 ProtocolVersion protocolVersion() const { return ar->protocolVersion(); }
47
48 const uint8_t* tryReadZeroCopy(const uint8_t* ptr, unsigned len) {
49 if constexpr (Ar::ownsUnderlyingMemory) {
50 return ptr;
51 } else {
52 if (len == 0)
53 return nullptr;
54 uint8_t* dat = new (arena()) uint8_t[len];
55 std::copy(ptr, ptr + len, dat);
56 return dat;
57 }
58 }
59
60 void addArena(Arena& arena) { arena = ar->arena(); }
61

Callers 3

loadMethod · 0.80
loadMethod · 0.80
loadMethod · 0.80

Calls 1

copyFunction · 0.85

Tested by

no test coverage detected