Skip to content

Commit

Permalink
Unroll one-shot decoder struct initialization
Browse files Browse the repository at this point in the history
Because we are about to add a ready-block channel notifier as a data
member, which cannot be value-initialized in a sensible manner.
  • Loading branch information
Eugene Kim committed Dec 18, 2018
1 parent 02c09dc commit ce34a60
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/impl/libraptorq/decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ func (*DecoderFactory) New(commonOTI uint64, schemeSpecificOTI uint32) (
wrapped := swig.NewBytesDecoder(swig.HostToNet64(commonOTI),
swig.HostToNet32(schemeSpecificOTI))
if wrapped.Initialized() {
decoder = &Decoder{wrapped, commonOTI, schemeSpecificOTI}
dec := new(Decoder)
dec.wrapped = wrapped
dec.commonOTI = commonOTI
dec.schemeSpecificOTI = schemeSpecificOTI
decoder = dec
runtime.SetFinalizer(decoder, finalizeDecoder)
} else {
swig.DeleteBytesDecoder(wrapped)
Expand Down

0 comments on commit ce34a60

Please sign in to comment.