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