summaryrefslogtreecommitdiff
path: root/vendor/github.com/godbus/dbus/v5/decoder.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/godbus/dbus/v5/decoder.go')
-rw-r--r--vendor/github.com/godbus/dbus/v5/decoder.go8
1 files changed, 1 insertions, 7 deletions
diff --git a/vendor/github.com/godbus/dbus/v5/decoder.go b/vendor/github.com/godbus/dbus/v5/decoder.go
index 97a827b83..d03bdd8e8 100644
--- a/vendor/github.com/godbus/dbus/v5/decoder.go
+++ b/vendor/github.com/godbus/dbus/v5/decoder.go
@@ -370,12 +370,6 @@ func (c *stringConverter) String(b []byte) string {
}
// toString converts a byte slice to a string without allocating.
-// Starting from Go 1.20 you should use unsafe.String.
func toString(b []byte) string {
- var s string
- h := (*reflect.StringHeader)(unsafe.Pointer(&s))
- h.Data = uintptr(unsafe.Pointer(&b[0]))
- h.Len = len(b)
-
- return s
+ return unsafe.String(&b[0], len(b))
}