MCPcopy Index your code
hub / github.com/Shopify/go-lua / readString

Method readString

undump.go:62–85  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

60}
61
62func (state *loadState) readString() (s string, err error) {
63 // Feel my pain
64 maxUint := ^uint(0)
65 var size uintptr
66 var size64 uint64
67 var size32 uint32
68 if uint64(maxUint) == math.MaxUint64 {
69 err = state.read(&size64)
70 size = uintptr(size64)
71 } else if maxUint == math.MaxUint32 {
72 err = state.read(&size32)
73 size = uintptr(size32)
74 } else {
75 panic(fmt.Sprintf("unsupported pointer size (%d)", maxUint))
76 }
77 if err != nil || size == 0 {
78 return
79 }
80 ba := make([]byte, size)
81 if err = state.read(ba); err == nil {
82 s = string(ba[:len(ba)-1])
83 }
84 return
85}
86
87func (state *loadState) readCode() (code []instruction, err error) {
88 n, err := state.readInt()

Callers 3

readLocalVariablesMethod · 0.95
readDebugMethod · 0.95
readConstantsMethod · 0.95

Calls 1

readMethod · 0.95

Tested by

no test coverage detected