In LevelDB's createKeyFor method we allocate size for 3 hashes but append 4 hashes. Eventhough append handles it intelligently, the code is misleading

This commit is contained in:
Varadharajan Mukundan 2015-01-05 18:21:20 +05:30
parent 9088fe376b
commit 98d5f3b8d7

View file

@ -150,7 +150,7 @@ func hashOf(s string) []byte {
}
func (qs *QuadStore) createKeyFor(d [4]quad.Direction, q quad.Quad) []byte {
key := make([]byte, 0, 2+(hashSize*3))
key := make([]byte, 0, 2+(hashSize*4))
// TODO(kortschak) Remove dependence on String() method.
key = append(key, []byte{d[0].Prefix(), d[1].Prefix()}...)
key = append(key, hashOf(q.Get(d[0]))...)