1 /* Ensures that we only have one copy of each unique string. This is
2 /* not designed for concurrent access. */
5 // This code should probably be moved somewhere more universal.
7 type CanonicalString struct {
11 func (cs *CanonicalString) Get(s string) (r string) {
13 cs.m = make(map[string]string)
15 value, found := cs.m[s]
20 // s may be a substring of a much larger string.
21 // If we store s, it will prevent that larger string from getting
23 // If this is something you worry about you should change this code
24 // to make an explict copy of s using a byte array.