ref: 375f3f20f33f050b677c5f51394109ccac7abe74
parent: 8da5ac5ac4258588634453d55cec95f29a02647b
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Mar 24 20:11:10 EDT 2018
Clean up setenv a bit.
--- a/lib/std/env+posixy.myr
+++ b/lib/std/env+posixy.myr
@@ -59,20 +59,22 @@
lock(envlck)
for envp : environ
- if envp != Zenvp
- env = cstrconvp(envp)
- n = min(name.len, env.len - 1)
- if eq(name, env[:n]) && env[n] == ('=' : byte)
- found = true
- break
- ;;
- idx++
+ if envp == Zenvp
+ break
;;
+
+ env = cstrconvp(envp)
+ n = min(name.len, env.len - 1)
+ if eq(name, env[:n]) && env[n] == ('=' : byte)
+ found = true
+ break
+ ;;
+ idx++
;;
if found
std.slfree(cstrconvp(environ[idx]))
else
- idx = env.len - 1
+ idx = environ.len - 1
std.slpush(&environ, Zenvp)
;;
environ[idx] = (e : byte#)