summary refs log tree commit diff stats
path: root/lib/pure/os.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2020-06-23 10:53:57 +0200
committerGitHub <noreply@github.com>2020-06-23 10:53:57 +0200
commitda29222f86f7689227ffe12605842d18c9bf0fc1 (patch)
tree312152d96e2313a81170c772ff7b51475299f344 /lib/pure/os.nim
parenta9eee6db65e72e0e11cbf5faf0794b1b6ac8bd0c (diff)
downloadNim-da29222f86f7689227ffe12605842d18c9bf0fc1.tar.gz
init checks and 'out' parameters (#14521)
* I don't care about observable stores
* enforce explicit initializations
* cleaner code for the stdlib
* stdlib: use explicit initializations
* make tests green
* algorithm.nim: set result explicitly
* remove out parameters and bring the PR into a mergable state
* updated the changelog
Diffstat (limited to 'lib/pure/os.nim')
-rw-r--r--lib/pure/os.nim6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/pure/os.nim b/lib/pure/os.nim
index bb09c966f..dcb63458b 100644
--- a/lib/pure/os.nim
+++ b/lib/pure/os.nim
@@ -417,7 +417,8 @@ proc relativePath*(path, base: string, sep = DirSep): string {.
       if not sameRoot(path, base):
         return path
 
-  var f, b: PathIter
+  var f = default PathIter
+  var b = default PathIter
   var ff = (0, -1)
   var bb = (0, -1) # (int, int)
   result = newStringOfCap(path.len)
@@ -1053,6 +1054,7 @@ when defined(windows) or defined(posix) or defined(nintendoswitch):
         assert quoteShellCommand(["aaa", "", "c d"]) == "aaa \"\" \"c d\""
 
     # can't use `map` pending https://github.com/nim-lang/Nim/issues/8303
+    result = ""
     for i in 0..<args.len:
       if i > 0: result.add " "
       result.add quoteShell(args[i])
@@ -2981,7 +2983,7 @@ proc getAppFilename*(): string {.rtl, extern: "nos$1", tags: [ReadIOEffect], noW
           setLen(result, L)
           break
   elif defined(macosx):
-    var size: cuint32
+    var size = cuint32(0)
     getExecPath1(nil, size)
     result = newString(int(size))
     if getExecPath2(result, size):