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
This commit is contained in:
parent
a9eee6db65
commit
da29222f86
53 changed files with 355 additions and 257 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue