* fix #13115

* fix testament
This commit is contained in:
flywind 2020-11-28 04:04:36 +08:00 • committed by GitHub
commit c555525227
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 10 deletions

View file

@ -154,6 +154,11 @@ proc c_fwrite*(buf: pointer, size, n: csize_t, f: CFilePtr): cint {.
proc c_fflush(f: CFilePtr): cint {.
importc: "fflush", header: "<stdio.h>".}
proc rawWriteString*(f: CFilePtr, s: cstring, length: int) {.compilerproc, nonReloadable, inline.} =
# we cannot throw an exception here!
discard c_fwrite(s, 1, cast[csize_t](length), f)
discard c_fflush(f)
proc rawWrite*(f: CFilePtr, s: cstring) {.compilerproc, nonReloadable, inline.} =
# we cannot throw an exception here!
discard c_fwrite(s, 1, cast[csize_t](s.len), f)