MCPcopy Index your code
hub / github.com/google/gvisor / Clone

Method Clone

pkg/buffer/buffer.go:412–421  ·  view source on GitHub ↗

Clone creates a copy-on-write clone of b. The underlying chunks are shared until they are written to.

()

Source from the content-addressed store, hash-verified

410// Clone creates a copy-on-write clone of b. The underlying chunks are shared
411// until they are written to.
412func (b *Buffer) Clone() Buffer {
413 other := Buffer{
414 size: b.size,
415 }
416 for v := b.data.Front(); v != nil; v = v.Next() {
417 newView := v.Clone()
418 other.data.PushBack(newView)
419 }
420 return other
421}
422
423// DeepClone creates a deep clone of b, copying data such that no bytes are
424// shared with any other Buffers.

Callers 6

TestBufferFunction · 0.95
TestReadFunction · 0.95
DeepCloneMethod · 0.95
writeMethod · 0.95
HandlePacketMethod · 0.95
bufFunction · 0.95

Calls 4

NextMethod · 0.65
CloneMethod · 0.65
FrontMethod · 0.45
PushBackMethod · 0.45

Tested by 3

TestBufferFunction · 0.76
TestReadFunction · 0.76
bufFunction · 0.76