mirror of https://github.com/golang/go.git
compress/bzip2,lzw: use built-in clear to simplify code
Change-Id: I16c17e322c757c8c657364065948d7cec66a8346
GitHub-Last-Rev: 9a5104fe98
GitHub-Pull-Request: golang/go#66377
Reviewed-on: https://go-review.googlesource.com/c/go/+/572199
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Auto-Submit: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: qiulaidongfeng <2645477756@qq.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
f40bf7486b
commit
af0ebdd4c1
|
|
@ -355,9 +355,7 @@ func (bz2 *reader) readBlock() (err error) {
|
|||
repeatPower := 0
|
||||
|
||||
// The `C' array (used by the inverse BWT) needs to be zero initialized.
|
||||
for i := range bz2.c {
|
||||
bz2.c[i] = 0
|
||||
}
|
||||
clear(bz2.c[:])
|
||||
|
||||
decoded := 0 // counts the number of symbols decoded by the current tree.
|
||||
for {
|
||||
|
|
|
|||
|
|
@ -170,9 +170,7 @@ func TestReaderReset(t *testing.T) {
|
|||
type devZero struct{}
|
||||
|
||||
func (devZero) Read(p []byte) (int, error) {
|
||||
for i := range p {
|
||||
p[i] = 0
|
||||
}
|
||||
clear(p)
|
||||
return len(p), nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue