Add a []byte argument to hash.Hash to allow an allocation to be saved.

This is the result of running `gofix -r hashsum` over the tree, changing
the hash function implementations by hand and then fixing a couple of
instances where gofix didn't catch something.

The changed implementations are as simple as possible while still
working: I'm not trying to optimise in this CL.

R=rsc, cw, rogpeppe
CC=golang-dev
https://golang.org/cl/5448065
This commit is contained in:
Adam Langley 2011-12-01 12:35:37 -05:00
parent 2308aefc84
commit bac7bc55a6
49 changed files with 202 additions and 200 deletions

View file

@ -189,7 +189,7 @@ func main() {
io.Copy(h, f)
f.Close()
}
cPrefix = fmt.Sprintf("_%x", h.Sum()[0:6])
cPrefix = fmt.Sprintf("_%x", h.Sum(nil)[0:6])
fs := make([]*File, len(goFiles))
for i, input := range goFiles {