summaryrefslogtreecommitdiff
path: root/src/lib/bytes/bytes.go
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2009-06-04 15:28:09 -0700
committerRob Pike <r@golang.org>2009-06-04 15:28:09 -0700
commit0c6945cf66e2cd24523545a33d1628219bcf3dd1 (patch)
tree10439a4451fcd1f9f6b197f570becb23becce33b /src/lib/bytes/bytes.go
parent5c58dcf306fc0d860ec46ddded509723632c46ac (diff)
downloadgolang-0c6945cf66e2cd24523545a33d1628219bcf3dd1.tar.gz
use the new bytes package
R=rsc DELTA=61 (8 added, 31 deleted, 22 changed) OCL=29897 CL=29899
Diffstat (limited to 'src/lib/bytes/bytes.go')
-rw-r--r--src/lib/bytes/bytes.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/bytes/bytes.go b/src/lib/bytes/bytes.go
index a64b07b74..dd299a82e 100644
--- a/src/lib/bytes/bytes.go
+++ b/src/lib/bytes/bytes.go
@@ -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).