forked from mirror/go-json
Remove unused arguments
This commit is contained in:
parent
3a3122c286
commit
f297c99af1
|
@ -165,8 +165,7 @@ func (e *Encoder) encode(v interface{}) error {
|
||||||
ctx := codeSet.ctx.Get().(*encodeRuntimeContext)
|
ctx := codeSet.ctx.Get().(*encodeRuntimeContext)
|
||||||
p := uintptr(header.ptr)
|
p := uintptr(header.ptr)
|
||||||
ctx.init(p)
|
ctx.init(p)
|
||||||
seenPtr := map[uintptr]struct{}{}
|
err := e.run(ctx, code)
|
||||||
err := e.run(ctx, 0, seenPtr, code)
|
|
||||||
codeSet.ctx.Put(ctx)
|
codeSet.ctx.Put(ctx)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -214,8 +213,7 @@ func (e *Encoder) encode(v interface{}) error {
|
||||||
c = code
|
c = code
|
||||||
}
|
}
|
||||||
|
|
||||||
seenPtr := map[uintptr]struct{}{}
|
if err := e.run(ctx, c); err != nil {
|
||||||
if err := e.run(ctx, 0, seenPtr, c); err != nil {
|
|
||||||
codeSet.ctx.Put(ctx)
|
codeSet.ctx.Put(ctx)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,9 +21,12 @@ func store(base uintptr, idx uintptr, p uintptr) {
|
||||||
*(*uintptr)(unsafe.Pointer(base + idx)) = p
|
*(*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)
|
ptrOffset := uintptr(0)
|
||||||
ctxptr := ctx.ptr()
|
ctxptr := ctx.ptr()
|
||||||
|
|
||||||
for {
|
for {
|
||||||
switch code.op {
|
switch code.op {
|
||||||
case opPtr:
|
case opPtr:
|
||||||
|
|
Loading…
Reference in New Issue