mirror of
https://github.com/waku-org/nwaku.git
synced 2025-02-09 13:35:27 +00:00
8 lines
261 B
Nim
8 lines
261 B
Nim
|
|
proc alloc*(str: cstring): cstring =
|
|
# Byte allocation from the given address.
|
|
# There should be the corresponding manual deallocation with deallocShared !
|
|
let ret = cast[cstring](allocShared(len(str) + 1))
|
|
copyMem(ret, str, len(str) + 1)
|
|
return ret
|