mirror of https://github.com/waku-org/nwaku.git
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
|