mirror of
https://github.com/golang/go
synced 2024-11-24 10:20:01 -07:00
encoding: simplify some code
Change-Id: I63aac663da4ce7bdd198d385f87929c74f6a5cf8 Reviewed-on: https://go-review.googlesource.com/c/go/+/360601 Trust: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
926856542f
commit
65f3478633
@ -142,9 +142,7 @@ func (e *encoder) Write(p []byte) (n int, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Trailing fringe.
|
// Trailing fringe.
|
||||||
for i := 0; i < len(p); i++ {
|
copy(e.buf[:], p)
|
||||||
e.buf[i] = p[i]
|
|
||||||
}
|
|
||||||
e.nbuf = len(p)
|
e.nbuf = len(p)
|
||||||
n += len(p)
|
n += len(p)
|
||||||
return
|
return
|
||||||
|
@ -221,9 +221,7 @@ func (e *encoder) Write(p []byte) (n int, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Trailing fringe.
|
// Trailing fringe.
|
||||||
for i := 0; i < len(p); i++ {
|
copy(e.buf[:], p)
|
||||||
e.buf[i] = p[i]
|
|
||||||
}
|
|
||||||
e.nbuf = len(p)
|
e.nbuf = len(p)
|
||||||
n += len(p)
|
n += len(p)
|
||||||
return
|
return
|
||||||
|
@ -229,9 +229,7 @@ func (e *encoder) Write(p []byte) (n int, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Trailing fringe.
|
// Trailing fringe.
|
||||||
for i := 0; i < len(p); i++ {
|
copy(e.buf[:], p)
|
||||||
e.buf[i] = p[i]
|
|
||||||
}
|
|
||||||
e.nbuf = len(p)
|
e.nbuf = len(p)
|
||||||
n += len(p)
|
n += len(p)
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user