Initialize the env eagerly.
This prevents potential allocations when getting the
PATH environment variable.
@@ -25,10 +25,13 @@ const Zenvp = (0 : byte#)
var envduped : bool = false
var environ : byte#[:]
+const __init__ = {
+ envinit()
+}
+
const getenv = {name
var n, env
- envinit()
for envp : environ
if envp != Zenvp
env = cstrconvp(envp)
@@ -51,8 +54,6 @@ const getenvv = {name, default
const setenv = {name, val
var n, e, env, idx, found
- envinit()
-
idx = 0
found = false
e = fmt("{}={}\0", name, val)
