mirror of
https://github.com/golang/go
synced 2024-11-22 12:34:48 -07:00
avoid pointer-to-slice operations in gobuild
R=r DELTA=19 (3 added, 1 deleted, 15 changed) OCL=30591 CL=30601
This commit is contained in:
parent
ee23998963
commit
2fcc8f2fb6
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user