File tree 3 files changed +5
-22
lines changed 3 files changed +5
-22
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,6 @@ import (
14
14
"go/token"
15
15
"internal/godebug"
16
16
"internal/goroot"
17
- "internal/unsafeheader"
18
17
"path"
19
18
"path/filepath"
20
19
"runtime"
@@ -948,14 +947,7 @@ func (sf *sourceFile) embeds() []embed {
948
947
}
949
948
950
949
func asString (b []byte ) string {
951
- p := (* unsafeheader .Slice )(unsafe .Pointer (& b )).Data
952
-
953
- var s string
954
- hdr := (* unsafeheader .String )(unsafe .Pointer (& s ))
955
- hdr .Data = p
956
- hdr .Len = len (b )
957
-
958
- return s
950
+ return unsafe .String (unsafe .SliceData (b ), len (b ))
959
951
}
960
952
961
953
// A decoder helps decode the index format.
Original file line number Diff line number Diff line change 13
13
package maphash
14
14
15
15
import (
16
- "internal/unsafeheader"
17
16
"unsafe"
18
17
)
19
18
@@ -72,11 +71,11 @@ func String(seed Seed, s string) uint64 {
72
71
panic ("maphash: use of uninitialized Seed" )
73
72
}
74
73
for len (s ) > bufSize {
75
- p := (* byte )(( * unsafeheader . String )( unsafe .Pointer ( & s )). Data )
74
+ p := (* byte )(unsafe .StringData ( s ) )
76
75
state = rthash (p , bufSize , state )
77
76
s = s [bufSize :]
78
77
}
79
- p := (* byte )(( * unsafeheader . String )( unsafe .Pointer ( & s )). Data )
78
+ p := (* byte )(unsafe .StringData ( s ) )
80
79
return rthash (p , len (s ), state )
81
80
}
82
81
@@ -190,7 +189,7 @@ func (h *Hash) WriteString(s string) (int, error) {
190
189
if len (s ) > bufSize {
191
190
h .initSeed ()
192
191
for len (s ) > bufSize {
193
- ptr := (* byte )(( * unsafeheader . String )( unsafe .Pointer ( & s )). Data )
192
+ ptr := (* byte )(unsafe .StringData ( s ) )
194
193
h .state .s = rthash (ptr , bufSize , h .state .s )
195
194
s = s [bufSize :]
196
195
}
Original file line number Diff line number Diff line change 7
7
package fuzz
8
8
9
9
import (
10
- "internal/unsafeheader"
11
10
"unsafe"
12
11
)
13
12
@@ -18,12 +17,5 @@ import (
18
17
func coverage () []byte {
19
18
addr := unsafe .Pointer (& _counters )
20
19
size := uintptr (unsafe .Pointer (& _ecounters )) - uintptr (addr )
21
-
22
- var res []byte
23
- * (* unsafeheader .Slice )(unsafe .Pointer (& res )) = unsafeheader.Slice {
24
- Data : addr ,
25
- Len : int (size ),
26
- Cap : int (size ),
27
- }
28
- return res
20
+ return unsafe .Slice ((* byte )(addr ), int (size ))
29
21
}
You can’t perform that action at this time.
0 commit comments