Revert toNimStr fix as per Araq request.
This commit is contained in:
parent
fc54fbfb98
commit
a9d09f2868
1 changed files with 1 additions and 2 deletions
|
|
@ -82,8 +82,7 @@ proc copyStr(s: NimString, start: int): NimString {.compilerProc.} =
|
||||||
proc toNimStr(str: cstring, len: int): NimString {.compilerProc.} =
|
proc toNimStr(str: cstring, len: int): NimString {.compilerProc.} =
|
||||||
result = rawNewStringNoInit(len)
|
result = rawNewStringNoInit(len)
|
||||||
result.len = len
|
result.len = len
|
||||||
c_memcpy(result.data, str, len)
|
c_memcpy(result.data, str, len + 1)
|
||||||
result.data[len] = '\0'
|
|
||||||
|
|
||||||
proc cstrToNimstr(str: cstring): NimString {.compilerRtl.} =
|
proc cstrToNimstr(str: cstring): NimString {.compilerRtl.} =
|
||||||
result = toNimStr(str, c_strlen(str))
|
result = toNimStr(str, c_strlen(str))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue