Remove unused arguments

This commit is contained in:
Masaaki Goshima 2020-09-04 13:53:25 +09:00
parent 3a3122c286
commit f297c99af1
2 changed files with 6 additions and 5 deletions

View File

@ -165,8 +165,7 @@ func (e *Encoder) encode(v interface{}) error {
ctx := codeSet.ctx.Get().(*encodeRuntimeContext)
p := uintptr(header.ptr)
ctx.init(p)
seenPtr := map[uintptr]struct{}{}
err := e.run(ctx, 0, seenPtr, code)
err := e.run(ctx, code)
codeSet.ctx.Put(ctx)
return err
}
@ -214,8 +213,7 @@ func (e *Encoder) encode(v interface{}) error {
c = code
}
seenPtr := map[uintptr]struct{}{}
if err := e.run(ctx, 0, seenPtr, c); err != nil {
if err := e.run(ctx, c); err != nil {
codeSet.ctx.Put(ctx)
return err
}

View File

@ -21,9 +21,12 @@ func store(base uintptr, idx uintptr, p uintptr) {
*(*uintptr)(unsafe.Pointer(base + idx)) = p
}
func (e *Encoder) run(ctx *encodeRuntimeContext, recursiveLevel int, seenPtr map[uintptr]struct{}, code *opcode) error {
func (e *Encoder) run(ctx *encodeRuntimeContext, code *opcode) error {
recursiveLevel := 0
seenPtr := map[uintptr]struct{}{}
ptrOffset := uintptr(0)
ctxptr := ctx.ptr()
for {
switch code.op {
case opPtr: