diff options
author | dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> | 2020-06-18 09:07:30 +0000 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2020-06-18 05:55:55 -0400 |
commit | 16dbc160c5f465ca1535bc13c07293f2b0dd89e5 (patch) | |
tree | 34428e29124555bf507a433ddc9f8875a13f8c1e /vendor/go.etcd.io/bbolt/unsafe.go | |
parent | 6472b44c3420fbba04dc3b5fe96be6576ee43e61 (diff) | |
download | podman-16dbc160c5f465ca1535bc13c07293f2b0dd89e5.tar.gz podman-16dbc160c5f465ca1535bc13c07293f2b0dd89e5.tar.bz2 podman-16dbc160c5f465ca1535bc13c07293f2b0dd89e5.zip |
Bump go.etcd.io/bbolt from 1.3.4 to 1.3.5
Bumps [go.etcd.io/bbolt](https://github.com/etcd-io/bbolt) from 1.3.4 to 1.3.5.
- [Release notes](https://github.com/etcd-io/bbolt/releases)
- [Commits](https://github.com/etcd-io/bbolt/compare/v1.3.4...v1.3.5)
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'vendor/go.etcd.io/bbolt/unsafe.go')
-rw-r--r-- | vendor/go.etcd.io/bbolt/unsafe.go | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/vendor/go.etcd.io/bbolt/unsafe.go b/vendor/go.etcd.io/bbolt/unsafe.go new file mode 100644 index 000000000..c0e503750 --- /dev/null +++ b/vendor/go.etcd.io/bbolt/unsafe.go @@ -0,0 +1,39 @@ +package bbolt + +import ( + "reflect" + "unsafe" +) + +func unsafeAdd(base unsafe.Pointer, offset uintptr) unsafe.Pointer { + return unsafe.Pointer(uintptr(base) + offset) +} + +func unsafeIndex(base unsafe.Pointer, offset uintptr, elemsz uintptr, n int) unsafe.Pointer { + return unsafe.Pointer(uintptr(base) + offset + uintptr(n)*elemsz) +} + +func unsafeByteSlice(base unsafe.Pointer, offset uintptr, i, j int) []byte { + // See: https://github.com/golang/go/wiki/cgo#turning-c-arrays-into-go-slices + // + // This memory is not allocated from C, but it is unmanaged by Go's + // garbage collector and should behave similarly, and the compiler + // should produce similar code. Note that this conversion allows a + // subslice to begin after the base address, with an optional offset, + // while the URL above does not cover this case and only slices from + // index 0. However, the wiki never says that the address must be to + // the beginning of a C allocation (or even that malloc was used at + // all), so this is believed to be correct. + return (*[maxAllocSize]byte)(unsafeAdd(base, offset))[i:j:j] +} + +// unsafeSlice modifies the data, len, and cap of a slice variable pointed to by +// the slice parameter. This helper should be used over other direct +// manipulation of reflect.SliceHeader to prevent misuse, namely, converting +// from reflect.SliceHeader to a Go slice type. +func unsafeSlice(slice, data unsafe.Pointer, len int) { + s := (*reflect.SliceHeader)(slice) + s.Data = uintptr(data) + s.Cap = len + s.Len = len +} |