diff options
author | Nathan Dench <ndenc2@gmail.com> | 2019-05-24 15:16:44 +1000 |
---|---|---|
committer | Nathan Dench <ndenc2@gmail.com> | 2019-05-24 15:16:44 +1000 |
commit | 107c1cdb09c575aa2f61d97f48d8587eb6bada4c (patch) | |
tree | ca7d008643efc555c388baeaf1d986e0b6b3e28c /vendor/github.com/golang/protobuf/proto/pointer_unsafe.go | |
parent | 844b5a68d8af4791755b8f0ad293cc99f5959183 (diff) | |
download | terraform-provider-statuscake-107c1cdb09c575aa2f61d97f48d8587eb6bada4c.tar.gz terraform-provider-statuscake-107c1cdb09c575aa2f61d97f48d8587eb6bada4c.tar.zst terraform-provider-statuscake-107c1cdb09c575aa2f61d97f48d8587eb6bada4c.zip |
Upgrade to 0.12
Diffstat (limited to 'vendor/github.com/golang/protobuf/proto/pointer_unsafe.go')
-rw-r--r-- | vendor/github.com/golang/protobuf/proto/pointer_unsafe.go | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/vendor/github.com/golang/protobuf/proto/pointer_unsafe.go b/vendor/github.com/golang/protobuf/proto/pointer_unsafe.go index d55a335..dbfffe0 100644 --- a/vendor/github.com/golang/protobuf/proto/pointer_unsafe.go +++ b/vendor/github.com/golang/protobuf/proto/pointer_unsafe.go | |||
@@ -85,16 +85,21 @@ func toPointer(i *Message) pointer { | |||
85 | 85 | ||
86 | // toAddrPointer converts an interface to a pointer that points to | 86 | // toAddrPointer converts an interface to a pointer that points to |
87 | // the interface data. | 87 | // the interface data. |
88 | func toAddrPointer(i *interface{}, isptr bool) pointer { | 88 | func toAddrPointer(i *interface{}, isptr, deref bool) (p pointer) { |
89 | // Super-tricky - read or get the address of data word of interface value. | 89 | // Super-tricky - read or get the address of data word of interface value. |
90 | if isptr { | 90 | if isptr { |
91 | // The interface is of pointer type, thus it is a direct interface. | 91 | // The interface is of pointer type, thus it is a direct interface. |
92 | // The data word is the pointer data itself. We take its address. | 92 | // The data word is the pointer data itself. We take its address. |
93 | return pointer{p: unsafe.Pointer(uintptr(unsafe.Pointer(i)) + ptrSize)} | 93 | p = pointer{p: unsafe.Pointer(uintptr(unsafe.Pointer(i)) + ptrSize)} |
94 | } else { | ||
95 | // The interface is not of pointer type. The data word is the pointer | ||
96 | // to the data. | ||
97 | p = pointer{p: (*[2]unsafe.Pointer)(unsafe.Pointer(i))[1]} | ||
94 | } | 98 | } |
95 | // The interface is not of pointer type. The data word is the pointer | 99 | if deref { |
96 | // to the data. | 100 | p.p = *(*unsafe.Pointer)(p.p) |
97 | return pointer{p: (*[2]unsafe.Pointer)(unsafe.Pointer(i))[1]} | 101 | } |
102 | return p | ||
98 | } | 103 | } |
99 | 104 | ||
100 | // valToPointer converts v to a pointer. v must be of pointer type. | 105 | // valToPointer converts v to a pointer. v must be of pointer type. |