summaryrefslogtreecommitdiff
path: root/vendor/github.com/modern-go/reflect2/reflect2.go
diff options
context:
space:
mode:
authordependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2021-09-13 17:25:11 +0000
committerGitHub <noreply@github.com>2021-09-13 17:25:11 +0000
commit9ae947654feaa9f26ebfb7978f3d0440b11ea5f7 (patch)
tree8de0752b1909fd58497ac8f5dd9551a53dbb709b /vendor/github.com/modern-go/reflect2/reflect2.go
parent73422de08d85d790397fe821f5fc6d5a05e30643 (diff)
downloadpodman-9ae947654feaa9f26ebfb7978f3d0440b11ea5f7.tar.gz
podman-9ae947654feaa9f26ebfb7978f3d0440b11ea5f7.tar.bz2
podman-9ae947654feaa9f26ebfb7978f3d0440b11ea5f7.zip
Bump github.com/json-iterator/go from 1.1.11 to 1.1.12
Bumps [github.com/json-iterator/go](https://github.com/json-iterator/go) from 1.1.11 to 1.1.12. - [Release notes](https://github.com/json-iterator/go/releases) - [Commits](https://github.com/json-iterator/go/compare/v1.1.11...v1.1.12) --- updated-dependencies: - dependency-name: github.com/json-iterator/go dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
Diffstat (limited to 'vendor/github.com/modern-go/reflect2/reflect2.go')
-rw-r--r--vendor/github.com/modern-go/reflect2/reflect2.go20
1 files changed, 11 insertions, 9 deletions
diff --git a/vendor/github.com/modern-go/reflect2/reflect2.go b/vendor/github.com/modern-go/reflect2/reflect2.go
index 63b49c799..c43c8b9d6 100644
--- a/vendor/github.com/modern-go/reflect2/reflect2.go
+++ b/vendor/github.com/modern-go/reflect2/reflect2.go
@@ -1,8 +1,9 @@
package reflect2
import (
- "github.com/modern-go/concurrent"
"reflect"
+ "runtime"
+ "sync"
"unsafe"
)
@@ -130,13 +131,13 @@ var ConfigSafe = Config{UseSafeImplementation: true}.Froze()
type frozenConfig struct {
useSafeImplementation bool
- cache *concurrent.Map
+ cache *sync.Map
}
func (cfg Config) Froze() *frozenConfig {
return &frozenConfig{
useSafeImplementation: cfg.UseSafeImplementation,
- cache: concurrent.NewMap(),
+ cache: new(sync.Map),
}
}
@@ -288,11 +289,12 @@ func NoEscape(p unsafe.Pointer) unsafe.Pointer {
}
func UnsafeCastString(str string) []byte {
+ bytes := make([]byte, 0)
stringHeader := (*reflect.StringHeader)(unsafe.Pointer(&str))
- sliceHeader := &reflect.SliceHeader{
- Data: stringHeader.Data,
- Cap: stringHeader.Len,
- Len: stringHeader.Len,
- }
- return *(*[]byte)(unsafe.Pointer(sliceHeader))
+ sliceHeader := (*reflect.SliceHeader)(unsafe.Pointer(&bytes))
+ sliceHeader.Data = stringHeader.Data
+ sliceHeader.Cap = stringHeader.Len
+ sliceHeader.Len = stringHeader.Len
+ runtime.KeepAlive(str)
+ return bytes
}