summary refs log tree commit diff stats
path: root/lib/system/sysio.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2013-05-20 02:17:24 +0200
committerAraq <rumpf_a@web.de>2013-05-20 02:17:24 +0200
commitbaf89e3d66543a242013bea26cb779a2d9c0e727 (patch)
tree8060c791247b214985f7fd8987de1a9c5c834769 /lib/system/sysio.nim
parenta23d418d78f7c35b2e7aed23ed6beb60e2542b83 (diff)
downloadNim-baf89e3d66543a242013bea26cb779a2d9c0e727.tar.gz
GC'ed wide strings for windows
Diffstat (limited to 'lib/system/sysio.nim')
-rw-r--r--lib/system/sysio.nim12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/system/sysio.nim b/lib/system/sysio.nim
index 3d5a53f03..31758eb45 100644
--- a/lib/system/sysio.nim
+++ b/lib/system/sysio.nim
@@ -168,18 +168,14 @@ when defined(windows) and not defined(useWinAnsi):
     importc: "_wfreopen", nodecl.}
 
   proc fopen(filename, mode: CString): pointer =
-    var f = allocWideCString(filename)
-    var m = allocWideCString(mode)
+    var f = newWideCString(filename)
+    var m = newWideCString(mode)
     result = wfopen(f, m)
-    dealloc m
-    dealloc f
 
   proc freopen(filename, mode: cstring, stream: TFile): TFile =
-    var f = allocWideCString(filename)
-    var m = allocWideCString(mode)
+    var f = newWideCString(filename)
+    var m = newWideCString(mode)
     result = wfreopen(f, m, stream)
-    dealloc m
-    dealloc f
 
 else:
   proc fopen(filename, mode: CString): pointer {.importc: "fopen", noDecl.}