MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / Clone

Method Clone

common/internal/byte_string.cc:831–853  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

829}
830
831ByteString ByteString::Clone(google::protobuf::Arena* absl_nonnull arena) const {
832 ABSL_DCHECK(arena != nullptr);
833
834 switch (GetKind()) {
835 case ByteStringKind::kSmall:
836 return ByteString(arena, GetSmall());
837 case ByteStringKind::kMedium: {
838 google::protobuf::Arena* absl_nullable other_arena = GetMediumArena();
839 if (arena != nullptr) {
840 if (arena == other_arena) {
841 return *this;
842 }
843 return ByteString(arena, GetMedium());
844 }
845 if (other_arena != nullptr) {
846 return ByteString(arena, GetMedium());
847 }
848 return *this;
849 }
850 case ByteStringKind::kLarge:
851 return ByteString(arena, GetLarge());
852 }
853}
854
855void ByteString::HashValue(absl::HashState state) const {
856 switch (GetKind()) {

Callers 1

TEST_PFunction · 0.45

Calls 4

GetKindFunction · 0.85
ByteStringFunction · 0.85
GetSmallFunction · 0.85
GetMediumFunction · 0.85

Tested by 1

TEST_PFunction · 0.36