Skip to content

Commit

Permalink
docs: clarify the pointer used (#323)
Browse files Browse the repository at this point in the history
  • Loading branch information
nrwiersma authored Nov 5, 2023
1 parent 8419cd2 commit 437fcd9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion codec_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ func encoderOfStruct(cfg *frozenConfig, schema Schema, typ reflect2.Type) ValEnc
if defaultType.LikePtr() {
defaultEncoder = &onePtrEncoder{defaultEncoder}
}

fields = append(fields, &structFieldEncoder{
defaultPtr: reflect2.PtrOf(def),
encoder: defaultEncoder,
Expand Down Expand Up @@ -332,6 +331,8 @@ type recordMapEncoder struct {

func (e *recordMapEncoder) Encode(ptr unsafe.Pointer, w *Writer) {
for _, field := range e.fields {
// The first property of mapEncoderField is the name, so a pointer
// to field is a pointer to the name.
valPtr := e.mapType.UnsafeGetIndex(ptr, reflect2.PtrOf(field))
if valPtr == nil {
// Missing required field
Expand Down

0 comments on commit 437fcd9

Please sign in to comment.