]> Sergey Matveev's repositories - btrtrc.git/commitdiff
bencode.Unmarshal: Remove unnecessary intermediate bufio.Reader
authorMatt Joiner <anacrolix@gmail.com>
Wed, 15 Jun 2016 04:54:40 +0000 (14:54 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Wed, 15 Jun 2016 04:54:40 +0000 (14:54 +1000)
bencode/api.go

index 9a77583e84b98175dabac10496815dd0bae8e9f4..89ac9d0e4d6f7c3d573d85ca2056bfa6fee3db07 100644 (file)
@@ -128,7 +128,7 @@ func Marshal(v interface{}) ([]byte, error) {
 // Unmarshal the bencode value in the 'data' to a value pointed by the 'v'
 // pointer, return a non-nil error if any.
 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)
 }