Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
8c22dd24
Commit
8c22dd24
authored
Dec 07, 2009
by
Christopher Wedgwood
Committed by
Rob Pike
Dec 07, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove copyBytes completely in favor of copy.
R=r, rsc
https://golang.org/cl/165068
parent
20c1ec26
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
11 deletions
+2
-11
buffer.go
src/pkg/bytes/buffer.go
+2
-11
No files found.
src/pkg/bytes/buffer.go
View file @
8c22dd24
...
...
@@ -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
];
copy
Bytes
(
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
}
copy
Bytes
(
p
,
0
,
b
.
buf
[
b
.
off
:
b
.
off
+
n
]);
copy
(
p
,
b
.
buf
[
b
.
off
:
b
.
off
+
n
]);
b
.
off
+=
n
;
return
n
,
err
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment