mirror of
https://github.com/golang/go
synced 2024-11-02 13:42:29 +00:00
net/textproto: use bytes.Clone
Change-Id: Ic73d667a98df3f2d1705a67e7e8625c6ba65cc0a Reviewed-on: https://go-review.googlesource.com/c/go/+/435284 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
This commit is contained in:
parent
a59e614aa1
commit
acc5e3a0c2
1 changed files with 2 additions and 6 deletions
|
@ -42,9 +42,7 @@ func (r *Reader) ReadLine() (string, error) {
|
|||
func (r *Reader) ReadLineBytes() ([]byte, error) {
|
||||
line, err := r.readLineSlice()
|
||||
if line != nil {
|
||||
buf := make([]byte, len(line))
|
||||
copy(buf, line)
|
||||
line = buf
|
||||
line = bytes.Clone(line)
|
||||
}
|
||||
return line, err
|
||||
}
|
||||
|
@ -111,9 +109,7 @@ func trim(s []byte) []byte {
|
|||
func (r *Reader) ReadContinuedLineBytes() ([]byte, error) {
|
||||
line, err := r.readContinuedLineSlice(noValidation)
|
||||
if line != nil {
|
||||
buf := make([]byte, len(line))
|
||||
copy(buf, line)
|
||||
line = buf
|
||||
line = bytes.Clone(line)
|
||||
}
|
||||
return line, err
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue