mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 04:36:42 +00:00
use in built bytes clone method
This commit is contained in:
parent
6f2cbb7a27
commit
4ee67b8d25
1 changed files with 3 additions and 8 deletions
|
|
@ -18,6 +18,7 @@
|
|||
package common
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
|
||||
|
|
@ -37,14 +38,8 @@ func FromHex(s string) []byte {
|
|||
}
|
||||
|
||||
// CopyBytes returns an exact copy of the provided bytes.
|
||||
func CopyBytes(b []byte) (copiedBytes []byte) {
|
||||
if b == nil {
|
||||
return nil
|
||||
}
|
||||
copiedBytes = make([]byte, len(b))
|
||||
copy(copiedBytes, b)
|
||||
|
||||
return
|
||||
func CopyBytes(b []byte) []byte {
|
||||
return bytes.Clone(b)
|
||||
}
|
||||
|
||||
// has0xPrefix validates str begins with '0x' or '0X'.
|
||||
|
|
|
|||
Loading…
Reference in a new issue