Module: Mesa
Branch: master
Commit: f2a1f894ba3af9299c9a1e770ef25247a6690637
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f2a1f894ba3af9299c9a1e770ef25247a6690637

Author: Tim Rowley <timothy.o.row...@intel.com>
Date:   Wed May  4 10:40:10 2016 -0600

swr: [rasterizer core] utility function for getenv

Reviewed-by: Bruce Cherniak <bruce.chern...@intel.com>

---

 src/gallium/drivers/swr/rasterizer/core/utils.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/src/gallium/drivers/swr/rasterizer/core/utils.h 
b/src/gallium/drivers/swr/rasterizer/core/utils.h
index e3c534d..1c4780a 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

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to