diff options
author | 2021-08-12 21:03:24 +0200 | |
---|---|---|
committer | 2021-08-12 21:03:24 +0200 | |
commit | 98263a7de64269898a2f81207e38943b5c8e8653 (patch) | |
tree | 743c90f109a6c5d27832d1dcef2388d939f0f77a /vendor/github.com/goccy/go-json/decode_anonymous_field.go | |
parent | Text duplication fix (#137) (diff) | |
download | gotosocial-98263a7de64269898a2f81207e38943b5c8e8653.tar.xz |
Grand test fixup (#138)
* start fixing up tests
* fix up tests + automate with drone
* fiddle with linting
* messing about with drone.yml
* some more fiddling
* hmmm
* add cache
* add vendor directory
* verbose
* ci updates
* update some little things
* update sig
Diffstat (limited to 'vendor/github.com/goccy/go-json/decode_anonymous_field.go')
-rw-r--r-- | vendor/github.com/goccy/go-json/decode_anonymous_field.go | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/vendor/github.com/goccy/go-json/decode_anonymous_field.go b/vendor/github.com/goccy/go-json/decode_anonymous_field.go new file mode 100644 index 000000000..77931f2ff --- /dev/null +++ b/vendor/github.com/goccy/go-json/decode_anonymous_field.go @@ -0,0 +1,35 @@ +package json + +import ( + "unsafe" +) + +type anonymousFieldDecoder struct { + structType *rtype + offset uintptr + dec decoder +} + +func newAnonymousFieldDecoder(structType *rtype, offset uintptr, dec decoder) *anonymousFieldDecoder { + return &anonymousFieldDecoder{ + structType: structType, + offset: offset, + dec: dec, + } +} + +func (d *anonymousFieldDecoder) decodeStream(s *stream, depth int64, p unsafe.Pointer) error { + if *(*unsafe.Pointer)(p) == nil { + *(*unsafe.Pointer)(p) = unsafe_New(d.structType) + } + p = *(*unsafe.Pointer)(p) + return d.dec.decodeStream(s, depth, unsafe.Pointer(uintptr(p)+d.offset)) +} + +func (d *anonymousFieldDecoder) decode(buf []byte, cursor, depth int64, p unsafe.Pointer) (int64, error) { + if *(*unsafe.Pointer)(p) == nil { + *(*unsafe.Pointer)(p) = unsafe_New(d.structType) + } + p = *(*unsafe.Pointer)(p) + return d.dec.decode(buf, cursor, depth, unsafe.Pointer(uintptr(p)+d.offset)) +} |