Skip to content

Commit

Permalink
Merge f25b2d8 into 281c13a
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivansete-status authored Dec 8, 2023
2 parents 281c13a + f25b2d8 commit fc26a81
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import
std/json,
stew/results
import
../../alloc

type
ResponseType {.pure.} = enum
Expand All @@ -26,13 +28,11 @@ proc createShared*(T: type InterThreadResponse,
if res.isOk():
let value = res.get()
ret[].respType = ResponseType.OK
ret[].content = cast[cstring](allocShared0(value.len + 1))
copyMem(ret[].content, unsafeAddr value, value.len + 1)
ret[].content = value.alloc()
else:
let error = res.error
ret[].respType = ResponseType.ERR
ret[].content = cast[cstring](allocShared0(error.len + 1))
copyMem(ret[].content, unsafeAddr error, error.len + 1)
ret[].content = res.error.alloc()
return ret

proc process*(T: type InterThreadResponse,
Expand Down

0 comments on commit fc26a81

Please sign in to comment.