summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--pkg/tcpip/buffer/view.go10
1 files changed, 4 insertions, 6 deletions
diff --git a/pkg/tcpip/buffer/view.go b/pkg/tcpip/buffer/view.go
index d151b8cf0..4a921ddcb 100644
--- a/pkg/tcpip/buffer/view.go
+++ b/pkg/tcpip/buffer/view.go
@@ -154,13 +154,11 @@ func (vv *VectorisedView) Size() int {
// ToView returns a single view containing the content of the vectorised view.
func (vv *VectorisedView) ToView() View {
- v := make([]byte, vv.size)
- u := v
- for i := range vv.views {
- n := copy(u, vv.views[i])
- u = u[n:]
+ u := make([]byte, 0, vv.size)
+ for _, v := range vv.views {
+ u = append(u, v...)
}
- return v
+ return u
}
// Views returns the slice containing the all views.