@@ -1880,21 +1880,6 @@ module ShallowCopy {
18801880 private use CTypes;
18811881 private use OS.POSIX;
18821882
1883- // The shallowCopy / shallowSwap code needs to be able to copy/swap
1884- // _array records. But c_ptrTo on an _array will return a pointer to
1885- // the first element, which messes up the shallowCopy/shallowSwap code
1886- //
1887- // As a workaround, this function just returns a pointer to the argument,
1888- // whether or not it is an array.
1889- //
1890- // TODO: these should be replaced with the appropriate c_addrOf[Const] calls
1891- private inline proc ptrTo(ref x) {
1892- return c_pointer_return(x);
1893- }
1894- private inline proc ptrToConst(const ref x) {
1895- return c_pointer_return_const(x);
1896- }
1897-
18981883 // These shallow copy functions "move" a record around
18991884 // (i.e. they neither swap nor call a copy initializer).
19001885 //
@@ -1907,11 +1892,11 @@ module ShallowCopy {
19071892 dst = src;
19081893 } else {
19091894 var size = c_sizeof(st);
1910- memcpy(ptrTo (dst), ptrTo (src), size);
1895+ memcpy(c_addrOf (dst), c_addrOf (src), size);
19111896 if boundsChecking {
19121897 // The version moved from should never be used again,
19131898 // but we clear it out just in case.
1914- memset(ptrTo (src), 0 , size);
1899+ memset(c_addrOf (src), 0 , size);
19151900 }
19161901 }
19171902 }
@@ -1941,11 +1926,11 @@ module ShallowCopy {
19411926 } else {
19421927 var size = c_sizeof(st);
19431928 // tmp = lhs
1944- memcpy(ptrTo (tmp), ptrTo (lhs), size);
1929+ memcpy(c_addrOf (tmp), c_addrOf (lhs), size);
19451930 // lhs = rhs
1946- memcpy(ptrTo (lhs), ptrTo (rhs), size);
1931+ memcpy(c_addrOf (lhs), c_addrOf (rhs), size);
19471932 // rhs = tmp
1948- memcpy(ptrTo (rhs), ptrTo (tmp), size);
1933+ memcpy(c_addrOf (rhs), c_addrOf (tmp), size);
19491934 }
19501935 }
19511936
@@ -1973,7 +1958,7 @@ module ShallowCopy {
19731958 if A._instance.isDefaultRectangular() {
19741959 type st = __primitive(" static field type" , A._value, " eltType" );
19751960 var size = (nElts: c_size_t)* c_sizeof(st);
1976- memcpy(ptrTo (A[ dst_idx] ), ptrTo (A[ src_idx] ), size);
1961+ memcpy(c_addrOf (A[ dst_idx] ), c_addrOf (A[ src_idx] ), size);
19771962 } else {
19781963 var ok = chpl__bulkTransferArray(/* dst*/ A,
19791964 {dst_idx..#nElts_idx},
@@ -2015,7 +2000,7 @@ module ShallowCopy {
20152000 SrcA._instance.isDefaultRectangular() {
20162001 type st = __primitive(" static field type" , DstA._value, " eltType" );
20172002 var size = (nElts: c_size_t)* c_sizeof(st);
2018- memcpy(ptrTo (DstA[ dst_idx] ), ptrToConst (SrcA[ src_idx] ), size);
2003+ memcpy(c_addrOf (DstA[ dst_idx] ), c_addrOfConst (SrcA[ src_idx] ), size);
20192004 } else {
20202005 var ok = chpl__bulkTransferArray(/* dst*/ DstA,
20212006 {dst_idx..#nElts_dst_idx},
0 commit comments