зеркало из https://github.com/golang/net.git
dns/dnsmessage: remove unnecessary []byte conversions
Change-Id: I1a5445584d582e8ace9d336a83e39d3a55d6ab45
GitHub-Last-Rev: 283a809ae9
GitHub-Pull-Request: golang/net#147
Reviewed-on: https://go-review.googlesource.com/c/net/+/426634
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
This commit is contained in:
Родитель
0081b4bacc
Коммит
ca03788e71
|
@ -1899,11 +1899,11 @@ type Name struct {
|
|||
|
||||
// NewName creates a new Name from a string.
|
||||
func NewName(name string) (Name, error) {
|
||||
if len([]byte(name)) > nameLen {
|
||||
if len(name) > nameLen {
|
||||
return Name{}, errCalcLen
|
||||
}
|
||||
n := Name{Length: uint8(len(name))}
|
||||
copy(n.Data[:], []byte(name))
|
||||
copy(n.Data[:], name)
|
||||
return n, nil
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче