ref: c8397e67b2c1f2a994c4399e0654fe145b97629a
parent: 974475bcfe52a488d9f5e83e474b6ca3670d5f6a
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Jun 23 18:24:54 EDT 2018
Initialize the env eagerly. This prevents potential allocations when getting the PATH environment variable.
--- a/lib/std/env+posixy.myr
+++ b/lib/std/env+posixy.myr
@@ -25,10 +25,13 @@
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)
@@ -50,8 +53,6 @@
const setenv = {name, val
var n, e, env, idx, found
-
- envinit()
idx = 0
found = false