diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-10-31 00:59:47 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-10-31 00:59:47 +0000 |
commit | 4a3da3a8a45d5496118798146de1fa4e5798ed5a (patch) | |
tree | 13beeaed3698c61903fe93fb1ce70bd9b18d4e7f /libgo/go/syscall/env_windows.go | |
parent | cd529f4d86a17a3e8959f2cb5ac7132a841ab6f1 (diff) | |
download | gcc-4a3da3a8a45d5496118798146de1fa4e5798ed5a.tar.gz |
runtime: Remove now unnecessary pad field from ParFor.
It is not needed due to the removal of the ctx field.
Reviewed-on: https://go-review.googlesource.com/16525
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229616 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/syscall/env_windows.go')
-rw-r--r-- | libgo/go/syscall/env_windows.go | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/libgo/go/syscall/env_windows.go b/libgo/go/syscall/env_windows.go index bc21690d9fd..1cb475428d7 100644 --- a/libgo/go/syscall/env_windows.go +++ b/libgo/go/syscall/env_windows.go @@ -16,19 +16,17 @@ func Getenv(key string) (value string, found bool) { if err != nil { return "", false } - b := make([]uint16, 100) - n, e := GetEnvironmentVariable(keyp, &b[0], uint32(len(b))) - if n == 0 && e == ERROR_ENVVAR_NOT_FOUND { - return "", false - } - if n > uint32(len(b)) { - b = make([]uint16, n) - n, e = GetEnvironmentVariable(keyp, &b[0], uint32(len(b))) - if n > uint32(len(b)) { - n = 0 + n := uint32(100) + for { + b := make([]uint16, n) + n, err = GetEnvironmentVariable(keyp, &b[0], uint32(len(b))) + if n == 0 && err == ERROR_ENVVAR_NOT_FOUND { + return "", false + } + if n <= uint32(len(b)) { + return string(utf16.Decode(b[:n])), true } } - return string(utf16.Decode(b[0:n])), true } func Setenv(key, value string) error { |