bencode.Unmarshal: Remove unnecessary intermediate bufio.Reader
This commit is contained in:
parent
9d1a33facc
commit
d9b7e7f297
|
@ -128,7 +128,7 @@ func Marshal(v interface{}) ([]byte, error) {
|
||||||
// Unmarshal the bencode value in the 'data' to a value pointed by the 'v'
|
// Unmarshal the bencode value in the 'data' to a value pointed by the 'v'
|
||||||
// pointer, return a non-nil error if any.
|
// pointer, return a non-nil error if any.
|
||||||
func Unmarshal(data []byte, v interface{}) error {
|
func Unmarshal(data []byte, v interface{}) error {
|
||||||
e := decoder{r: bufio.NewReader(bytes.NewBuffer(data))}
|
e := decoder{r: bytes.NewBuffer(data)}
|
||||||
return e.decode(v)
|
return e.decode(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue