aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/bytes/bytes.go
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2009-11-18 15:24:24 -0800
committerRob Pike <r@golang.org>2009-11-18 15:24:24 -0800
commite70cedfaece8b51babad7b4aa4ae9f386bb37199 (patch)
treed823da3e44eba5b4c35229088261f02786c86a95 /src/pkg/bytes/bytes.go
parent093493c6a54458e79ddc1d18441a427747d1fafa (diff)
downloadgo-e70cedfaece8b51babad7b4aa4ae9f386bb37199.tar.xz
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
Diffstat (limited to 'src/pkg/bytes/bytes.go')
-rw-r--r--src/pkg/bytes/bytes.go20
1 files changed, 3 insertions, 17 deletions
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;