aboutsummaryrefslogtreecommitdiff
path: root/bytesconv.go
diff options
context:
space:
mode:
authorGravatar Erik Dubbelboer <erik@dubbelboer.com> 2023-02-03 15:41:39 +0800
committerGravatar GitHub <noreply@github.com> 2023-02-03 08:41:39 +0100
commit9d5a7bf7e3086d12e71b078da56128e1e324fe4a (patch)
tree67b51dbf8f0cbc9f4d0421b3d4c98d15bfb2778e /bytesconv.go
parentdocs: add http2curl (#1480) (diff)
downloadfasthttp-9d5a7bf7e3086d12e71b078da56128e1e324fe4a.tar.gz
fasthttp-9d5a7bf7e3086d12e71b078da56128e1e324fe4a.tar.bz2
fasthttp-9d5a7bf7e3086d12e71b078da56128e1e324fe4a.zip
Add support for Go 1.20 (#1481)
Diffstat (limited to 'bytesconv.go')
-rw-r--r--bytesconv.go27
1 files changed, 0 insertions, 27 deletions
diff --git a/bytesconv.go b/bytesconv.go
index 274082f..9b2ffeb 100644
--- a/bytesconv.go
+++ b/bytesconv.go
@@ -10,10 +10,8 @@ import (
"io"
"math"
"net"
- "reflect"
"sync"
"time"
- "unsafe"
)
// AppendHTMLEscape appends html-escaped s to dst and returns the extended dst.
@@ -317,31 +315,6 @@ func lowercaseBytes(b []byte) {
}
}
-// b2s converts byte slice to a string without memory allocation.
-// See https://groups.google.com/forum/#!msg/Golang-Nuts/ENgbUzYvCuU/90yGx7GUAgAJ .
-//
-// Note it may break if string and/or slice header will change
-// in the future go versions.
-func b2s(b []byte) string {
- /* #nosec G103 */
- return *(*string)(unsafe.Pointer(&b))
-}
-
-// s2b converts string to a byte slice without memory allocation.
-//
-// Note it may break if string and/or slice header will change
-// in the future go versions.
-func s2b(s string) (b []byte) {
- /* #nosec G103 */
- bh := (*reflect.SliceHeader)(unsafe.Pointer(&b))
- /* #nosec G103 */
- sh := (*reflect.StringHeader)(unsafe.Pointer(&s))
- bh.Data = sh.Data
- bh.Cap = sh.Len
- bh.Len = sh.Len
- return b
-}
-
// AppendUnquotedArg appends url-decoded src to dst and returns appended dst.
//
// dst may point to src. In this case src will be overwritten.