diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-09-13 14:51:29 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-13 14:51:29 -0400 |
commit | 55a7f89fcae7ed8f16e10d4dae84cbdd3ecb1272 (patch) | |
tree | 198e952597004d3dca4c4b9c7fe52281f84c8254 /vendor/github.com/modern-go/reflect2/reflect2.go | |
parent | f07a2bfbec03bc9c86414e697ac797ce04807da1 (diff) | |
parent | 9ae947654feaa9f26ebfb7978f3d0440b11ea5f7 (diff) | |
download | podman-55a7f89fcae7ed8f16e10d4dae84cbdd3ecb1272.tar.gz podman-55a7f89fcae7ed8f16e10d4dae84cbdd3ecb1272.tar.bz2 podman-55a7f89fcae7ed8f16e10d4dae84cbdd3ecb1272.zip |
Merge pull request #11549 from containers/dependabot/go_modules/github.com/json-iterator/go-1.1.12
Bump github.com/json-iterator/go from 1.1.11 to 1.1.12
Diffstat (limited to 'vendor/github.com/modern-go/reflect2/reflect2.go')
-rw-r--r-- | vendor/github.com/modern-go/reflect2/reflect2.go | 20 |
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 } |