Make hashOf a function

This commit is contained in:
kortschak 2014-08-27 23:25:50 +09:30
parent d8866478df
commit a22eb42482
3 changed files with 36 additions and 36 deletions

View file

@ -102,14 +102,14 @@ func newQuadStore(addr string, options graph.Options) (graph.QuadStore, error) {
}
func (qs *QuadStore) getIdForQuad(t quad.Quad) string {
id := qs.hashOf(t.Subject)
id += qs.hashOf(t.Predicate)
id += qs.hashOf(t.Object)
id += qs.hashOf(t.Label)
id := hashOf(t.Subject)
id += hashOf(t.Predicate)
id += hashOf(t.Object)
id += hashOf(t.Label)
return id
}
func (qs *QuadStore) hashOf(s string) string {
func hashOf(s string) string {
h := hashPool.Get().(hash.Hash)
h.Reset()
defer hashPool.Put(h)
@ -288,7 +288,7 @@ func (qs *QuadStore) QuadsAllIterator() graph.Iterator {
}
func (qs *QuadStore) ValueOf(s string) graph.Value {
return qs.hashOf(s)
return hashOf(s)
}
func (qs *QuadStore) NameOf(v graph.Value) string {