EnvironGetenv: use strncmp instead of strlen and memcmp (dotnet/coreclr#27632)
authorBond-009 <bond.009@outlook.com>
Sat, 2 Nov 2019 17:13:47 +0000 (18:13 +0100)
committerJan Kotas <jkotas@microsoft.com>
Sat, 2 Nov 2019 17:13:47 +0000 (10:13 -0700)
commit7d24cea1bfa4c80d90926638effa5dbd31481126
tree6e4c2b424b54914afa15d8479a3c39f2a646207e
parent0f7d67f89eee8903f7ee2c34b5cfa4866eff3e59
EnvironGetenv: use strncmp instead of strlen and memcmp (dotnet/coreclr#27632)

Instead of iterating twice over the string, first for searching the
null-terminator and then to compare it to `name`, we only iterate
over it once.

Commit migrated from https://github.com/dotnet/coreclr/commit/d606bff508cf57477b21ebbe8c8a2f6494feed7e
src/coreclr/src/pal/src/misc/environ.cpp