use the new bytes package

R=rsc
DELTA=61  (8 added, 31 deleted, 22 changed)
OCL=29897
CL=29899
This commit is contained in:
Rob Pike 2009-06-04 15:28:09 -07:00
parent 9a9ffb2b0e
commit 424f4f0ff5
6 changed files with 23 additions and 34 deletions

View file

@ -43,11 +43,12 @@ func Equal(a, b []byte) bool {
// Copy copies the source to the destination, stopping when the source
// is all transferred. The caller must guarantee that there is enough
// room in the destination.
func Copy(dst, src []byte) {
// room in the destination. It returns the number of bytes copied
func Copy(dst, src []byte) int {
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).