Don't depend on string.h in codegen (#8299)

This commit is contained in:
Yuriy Glukhov
2018-07-13 18:41:59 +03:00
committed by Andreas Rumpf
parent 54a85b4ff5
commit dfe3f16022
9 changed files with 87 additions and 54 deletions

View File

@@ -322,8 +322,7 @@ type MemSlice* = object ## represent slice of a MemFile for iteration over deli
proc `==`*(x, y: MemSlice): bool =
## Compare a pair of MemSlice for strict equality.
proc memcmp(a, b: pointer, n:int):int {.importc: "memcmp",header: "string.h".}
result = (x.size == y.size and memcmp(x.data, y.data, x.size) == 0)
result = (x.size == y.size and equalMem(x.data, y.data, x.size))
proc `$`*(ms: MemSlice): string {.inline.} =
## Return a Nim string built from a MemSlice.