list-type.go: use of copy() for copying lists

This commit is contained in:
Celestino Amoroso 2024-07-07 07:34:58 +02:00
parent 93dac956fb
commit 340b99bad7

View File

@ -26,9 +26,10 @@ func newList(listAny []any) (list *ListType) {
func NewList(listAny []any) (list *ListType) {
if listAny != nil {
ls := make(ListType, len(listAny))
for i, item := range listAny {
ls[i] = item
}
// for i, item := range listAny {
// ls[i] = item
// }
copy(ls, listAny)
list = &ls
}
return