From e70cedfaece8b51babad7b4aa4ae9f386bb37199 Mon Sep 17 00:00:00 2001 From: Rob Pike Date: Wed, 18 Nov 2009 15:24:24 -0800 Subject: remove bytes.Copy replace all calls with calls to copy use copy in regexp and bytes.Buffer R=rsc CC=golang-dev https://golang.org/cl/157073 --- src/pkg/bytes/bytes.go | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) (limited to 'src/pkg/bytes/bytes.go') diff --git a/src/pkg/bytes/bytes.go b/src/pkg/bytes/bytes.go index 0c585bd80f..2739c5a3fe 100644 --- a/src/pkg/bytes/bytes.go +++ b/src/pkg/bytes/bytes.go @@ -44,20 +44,6 @@ func Equal(a, b []byte) bool { return true; } -// Copy copies bytes from src to dst, -// stopping when either all of src has been copied -// or all of dst has been filled. -// It returns the number of bytes copied. -func Copy(dst, src []byte) int { - if len(src) > len(dst) { - src = src[0:len(dst)] - } - for i, x := range src { - dst[i] = x - } - return len(src); -} - // explode splits s into an array of UTF-8 sequences, one per Unicode character (still arrays of bytes), // up to a maximum of n byte arrays. Invalid UTF-8 sequences are chopped into individual bytes. func explode(s []byte, n int) [][]byte { @@ -315,10 +301,10 @@ func Add(s, t []byte) []byte { s = s[0 : lens+lent] } else { news := make([]byte, lens+lent, resize(lens+lent)); - Copy(news, s); + copy(news, s); s = news; } - Copy(s[lens:lens+lent], t); + copy(s[lens:lens+lent], t); return s; } @@ -331,7 +317,7 @@ func AddByte(s []byte, t byte) []byte { s = s[0 : lens+1] } else { news := make([]byte, lens+1, resize(lens+1)); - Copy(news, s); + copy(news, s); s = news; } s[lens] = t; -- cgit v1.3-5-g9baa