summaryrefslogtreecommitdiff
path: root/src/pkg/bytes/buffer.go
diff options
context:
space:
mode:
authorChristopher Wedgwood <cw@f00f.org>2009-12-07 11:31:56 -0800
committerChristopher Wedgwood <cw@f00f.org>2009-12-07 11:31:56 -0800
commite9c32abe4f3c8e19ef6d6834bef4643213ac3534 (patch)
tree7874960ef5b9f11a6667c726efb0a131dc1f5f20 /src/pkg/bytes/buffer.go
parent885c468159944c3f228a229a78ba8480cfe1b645 (diff)
downloadgolang-e9c32abe4f3c8e19ef6d6834bef4643213ac3534.tar.gz
Remove copyBytes completely in favor of copy.
R=r, rsc http://codereview.appspot.com/165068 Committer: Rob Pike <r@golang.org>
Diffstat (limited to 'src/pkg/bytes/buffer.go')
-rw-r--r--src/pkg/bytes/buffer.go13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/pkg/bytes/buffer.go b/src/pkg/bytes/buffer.go
index 61780947f..41838d490 100644
--- a/src/pkg/bytes/buffer.go
+++ b/src/pkg/bytes/buffer.go
@@ -19,15 +19,6 @@ func copyString(dst []byte, doff int, str string) {
}
}
-// Copy from bytes to byte array at offset doff. Assume there's room.
-func copyBytes(dst []byte, doff int, src []byte) {
- if len(src) == 1 {
- dst[doff] = src[0];
- return;
- }
- copy(dst[doff:], src);
-}
-
// A Buffer is a variable-sized buffer of bytes
// with Read and Write methods.
// The zero value for Buffer is an empty buffer ready to use.
@@ -98,7 +89,7 @@ func (b *Buffer) Write(p []byte) (n int, err os.Error) {
b.resize(n)
}
b.buf = b.buf[0 : b.off+m+n];
- copyBytes(b.buf, b.off+m, p);
+ copy(b.buf[b.off+m:], p);
return n, nil;
}
@@ -194,7 +185,7 @@ func (b *Buffer) Read(p []byte) (n int, err os.Error) {
n = m
}
- copyBytes(p, 0, b.buf[b.off:b.off+n]);
+ copy(p, b.buf[b.off:b.off+n]);
b.off += n;
return n, err;
}