Skip to content

Commit

Permalink
remove some TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
zerosnake0 committed Jan 16, 2020
1 parent e3b4379 commit 3aac47e
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ func (enc *Encoder) createEncoderInternal(cache, internalCache encoderCache, typ
cache[rType] = &directEncoder{x.encoder}
}
case *mapEncoderBuilder:
// TODO: key/value encoder
// TODO: key encoder
x.encoder.elemEncoder = internalCache[x.elemRType]
cache[rType] = &directEncoder{x.encoder}
case *sliceEncoderBuilder:
Expand Down
5 changes: 4 additions & 1 deletion iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"fmt"
"io"
"runtime"
)

// for fast reset
Expand Down Expand Up @@ -129,7 +130,6 @@ func (it *Iterator) readMore() error {
n int
err error
)
// TODO: risk of infinite loop?
for {
if it.capture {
var buf [bufferSize]byte
Expand All @@ -156,6 +156,9 @@ func (it *Iterator) readMore() error {
if n > 0 {
return nil
}
// n == 0 && err == nil
// the implementation of the reader is wrong
runtime.Gosched()
}
}

Expand Down
1 change: 0 additions & 1 deletion link_reflect.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ func mapiternext(it *hiter)

func unsafeMakeSlice(elemRType rtype, length, cap int) unsafe.Pointer {
return unsafe.Pointer(&sliceHeader{
// TODO: is this safe?
Data: uintptr(unsafe_NewArray(elemRType, cap)),
Len: length,
Cap: cap,
Expand Down
2 changes: 0 additions & 2 deletions streamer.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ func (s *Streamer) Flush() error {
// see comment of io.Writer
n, err := s.writer.Write(s.buffer)
if n < l {
// TODO: shall we accept the writers which
// TODO: do not implement Write method correctly?
copy(s.buffer, s.buffer[n:])
s.buffer = s.buffer[:l-n]
} else {
Expand Down
1 change: 0 additions & 1 deletion struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ func describeStruct(st reflect.Type, tagKey string, onlyTaggedField bool) struct
}
}

// TODO: field name for encoder
fields = append(fields, field)
if count[f.typ] > 1 {
/* when we arrived here, we are inside a level, where there are at least
Expand Down
1 change: 0 additions & 1 deletion val_decoder_native.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ func (*stringDecoder) Decode(ptr unsafe.Pointer, it *Iterator, opts *DecOpts) er
}
l := len(s)
if l < 2 {
// TODO: custom error
return BadQuotedStringError(s)
}
switch s[0] {
Expand Down
1 change: 0 additions & 1 deletion val_encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ type ValEncoder interface {
type notSupportedEncoder string

func (enc notSupportedEncoder) IsEmpty(ptr unsafe.Pointer) bool {
// TODO: error in interface?
return false
}

Expand Down
2 changes: 1 addition & 1 deletion val_encoder_json_number.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ func (*jsonNumberEncoder) Encode(ptr unsafe.Pointer, s *Streamer, opts *EncOpts)
if str == "" {
str = "0"
}
// TODO: the standard lib will check the validity
// TODO: the standard library will check the validity in future
s.RawString(str)
}

0 comments on commit 3aac47e

Please sign in to comment.