Skip to content

Commit

Permalink
refactor: use existing ptrToString func
Browse files Browse the repository at this point in the history
  • Loading branch information
itaysk committed Dec 14, 2024
1 parent 51397d9 commit 46aa036
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/module/wasm/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ func marshal(v any) uint64 {
}

func unmarshal(ptr, size uint32, v any) error {
b := unsafe.Slice((*byte)(unsafe.Pointer(uintptr(ptr))), size)
if err := json.Unmarshal(b, v); err != nil {
s := ptrToString(ptr, size)
if err := json.Unmarshal([]byte(s), v); err != nil {
return fmt.Errorf("unmarshal error: %s", err)
}
return nil
Expand Down

0 comments on commit 46aa036

Please sign in to comment.