use append

R=gri, r, r2
CC=golang-dev
https://golang.org/cl/2743042
This commit is contained in:
Russ Cox 2010-10-27 19:47:23 -07:00
parent d8b5d039cd
commit 69c4e9380b
32 changed files with 109 additions and 404 deletions

View file

@ -493,15 +493,7 @@ func parseScript(line string, scripts map[string][]Script) {
}
}
name := matches[3]
s, ok := scripts[name]
if !ok || len(s) == cap(s) {
ns := make([]Script, len(s), len(s)+100)
copy(ns, s)
s = ns
}
s = s[0 : len(s)+1]
s[len(s)-1] = Script{uint32(lo), uint32(hi), name}
scripts[name] = s
scripts[name] = append(scripts[name], Script{uint32(lo), uint32(hi), name})
}
// The script tables have a lot of adjacent elements. Fold them together.