Commit 73fd2989 authored by Nigel Tao's avatar Nigel Tao

reflect: rename reflect.ArrayCopy to be reflect.Copy.

R=r
CC=golang-dev
https://golang.org/cl/3601041
parent 7ec69c17
......@@ -591,7 +591,7 @@ func parseField(v reflect.Value, bytes []byte, initOffset int, params fieldParam
sliceValue := v.(*reflect.SliceValue)
sliceValue.Set(reflect.MakeSlice(sliceValue.Type().(*reflect.SliceType), len(newSlice), len(newSlice)))
if err1 == nil {
reflect.ArrayCopy(sliceValue, reflect.NewValue(newSlice).(reflect.ArrayOrSliceValue))
reflect.Copy(sliceValue, reflect.NewValue(newSlice).(reflect.ArrayOrSliceValue))
}
err = err1
return
......@@ -683,7 +683,7 @@ func parseField(v reflect.Value, bytes []byte, initOffset int, params fieldParam
sliceType := fieldType.(*reflect.SliceType)
if sliceType.Elem().Kind() == reflect.Uint8 {
val.Set(reflect.MakeSlice(sliceType, len(innerBytes), len(innerBytes)))
reflect.ArrayCopy(val, reflect.NewValue(innerBytes).(reflect.ArrayOrSliceValue))
reflect.Copy(val, reflect.NewValue(innerBytes).(reflect.ArrayOrSliceValue))
return
}
newSlice, err1 := parseSequenceOf(innerBytes, sliceType, sliceType.Elem())
......
......@@ -344,7 +344,7 @@ func (d *decodeState) array(v reflect.Value) {
newcap = 4
}
newv := reflect.MakeSlice(sv.Type().(*reflect.SliceType), sv.Len(), newcap)
reflect.ArrayCopy(newv, sv)
reflect.Copy(newv, sv)
sv.Set(newv)
}
if i >= av.Len() && sv != nil {
......
......@@ -513,7 +513,7 @@ func TestCopyArray(t *testing.T) {
ab := vb.(*PtrValue).Elem().(*SliceValue)
for tocopy := 1; tocopy <= 7; tocopy++ {
aa.SetLen(tocopy)
ArrayCopy(ab, aa)
Copy(ab, aa)
aa.SetLen(8)
for i := 0; i < tocopy; i++ {
if a[i] != b[i] {
......
......@@ -400,11 +400,11 @@ type ArrayOrSliceValue interface {
addr() addr
}
// ArrayCopy copies the contents of src into dst until either
// Copy copies the contents of src into dst until either
// dst has been filled or src has been exhausted.
// It returns the number of elements copied.
// The arrays dst and src must have the same element type.
func ArrayCopy(dst, src ArrayOrSliceValue) int {
func Copy(dst, src ArrayOrSliceValue) int {
// TODO: This will have to move into the runtime
// once the real gc goes in.
de := dst.Type().(ArrayOrSliceType).Elem()
......@@ -439,7 +439,7 @@ func (v *ArrayValue) Set(x *ArrayValue) {
panic(cannotSet)
}
typesMustMatch(v.typ, x.typ)
ArrayCopy(v, x)
Copy(v, x)
}
// Set sets v to the value x.
......
......@@ -233,7 +233,7 @@ func (p *Parser) unmarshal(val reflect.Value, start *StartElement) os.Error {
ncap = 4
}
new := reflect.MakeSlice(typ, n, ncap)
reflect.ArrayCopy(new, v)
reflect.Copy(new, v)
v.Set(new)
}
v.SetLen(n + 1)
......
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