allocate copyHandler on stack

pull/1524/head^2
Darien Raymond 2018-08-09 13:30:44 +02:00
parent ab87c240f7
commit 35129e6518
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
1 changed files with 3 additions and 3 deletions

View File

@ -103,11 +103,11 @@ func copyInternal(reader Reader, writer Writer, handler *copyHandler) error {
// Copy dumps all payload from reader to writer or stops when an error occurs. It returns nil when EOF.
func Copy(reader Reader, writer Writer, options ...CopyOption) error {
handler := new(copyHandler)
var handler copyHandler
for _, option := range options {
option(handler)
option(&handler)
}
err := copyInternal(reader, writer, handler)
err := copyInternal(reader, writer, &handler)
if err != nil && errors.Cause(err) != io.EOF {
return err
}