Commit 2fcc8f2f authored by Russ Cox's avatar Russ Cox

avoid pointer-to-slice operations in gobuild

R=r
DELTA=19  (3 added, 1 deleted, 15 changed)
OCL=30591
CL=30601
parent ee239989
......@@ -60,31 +60,33 @@ type Info struct {
var verbose = flag.Bool("v", false, "verbose mode")
var writeMakefile = flag.Bool("m", false, "write Makefile to standard output")
func PushPkg(v *[]*Pkg, p *Pkg) {
func PushPkg(vp *[]*Pkg, p *Pkg) {
v := *vp;
n := len(v);
if n >= cap(v) {
m := 2*n + 10;
a := make([]*Pkg, n, m);
for i := range *v {
for i := range v {
a[i] = v[i];
}
*v = a;
v = a;
}
*v = v[0:n+1];
*vp = v[0:n+1];
v[n] = p;
}
func PushFile(v *[]*File, p *File) {
func PushFile(vp *[]*File, p *File) {
v := *vp;
n := len(v);
if n >= cap(v) {
m := 2*n + 10;
a := make([]*File, n, m);
for i := range *v {
for i := range v {
a[i] = v[i];
}
*v = a;
v = a;
}
*v = v[0:n+1];
*vp = v[0:n+1];
v[n] = p;
}
......
......@@ -71,21 +71,21 @@ func init() {
}
}
func PushString(v *[]string, p string) {
func PushString(vp *[]string, p string) {
v := *vp;
n := len(v);
if n >= cap(v) {
m := 2*n + 10;
a := make([]string, n, m);
for i := range *v {
for i := range v {
a[i] = v[i];
}
*v = a;
v = a;
}
*v = v[0:n+1];
*vp = v[0:n+1];
v[n] = p;
}
func run(argv []string, flag int) (ok bool) {
argv0 := bin[argv[0]];
null, err := os.Open("/dev/null", os.O_RDWR, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment