diff options
author | Tim Rowley <timothy.o.rowley@intel.com> | 2016-05-04 10:40:10 -0600 |
---|---|---|
committer | Tim Rowley <timothy.o.rowley@intel.com> | 2016-05-19 16:25:48 -0500 |
commit | f2a1f894ba3af9299c9a1e770ef25247a6690637 (patch) | |
tree | 142c07258ad7ec283229b700e7205461f70eeb18 /src/gallium/drivers | |
parent | 4a58b21ef777e2e47d0ac9ead3d8dccae395df03 (diff) |
swr: [rasterizer core] utility function for getenv
Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/swr/rasterizer/core/utils.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/core/utils.h b/src/gallium/drivers/swr/rasterizer/core/utils.h index e3c534dd851..1c4780a5276 100644 --- a/src/gallium/drivers/swr/rasterizer/core/utils.h +++ b/src/gallium/drivers/swr/rasterizer/core/utils.h @@ -866,3 +866,20 @@ struct TemplateArgUnroller } }; +////////////////////////////////////////////////////////////////////////// +/// Helper used to get an environment variable +////////////////////////////////////////////////////////////////////////// +static INLINE std::string GetEnv(const std::string& variableName) +{ + std::string output; +#if defined(_WIN32) + DWORD valueSize = GetEnvironmentVariableA(variableName.c_str(), nullptr, 0); + if (!valueSize) return output; + output.resize(valueSize - 1); // valueSize includes null, output.resize() does not + GetEnvironmentVariableA(variableName.c_str(), &output[0], valueSize); +#else + output = getenv(variableName.c_str()); +#endif + + return output; +}
\ No newline at end of file |