From 1aaf65abfecbde8548f90b1d0b0308b21bd0776d Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 12 Aug 2019 03:59:52 -0700 Subject: Add methods to get env vars as an optional --- alc/alu.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'alc/alu.cpp') diff --git a/alc/alu.cpp b/alc/alu.cpp index 8cef4228..aebb2236 100644 --- a/alc/alu.cpp +++ b/alc/alu.cpp @@ -73,6 +73,7 @@ #include "mixer/defs.h" #include "opthelpers.h" #include "ringbuffer.h" +#include "strutils.h" #include "threads.h" #include "uhjfilter.h" #include "vecmat.h" @@ -87,18 +88,22 @@ using namespace std::placeholders; ALfloat InitConeScale() { ALfloat ret{1.0f}; - const char *str{getenv("__ALSOFT_HALF_ANGLE_CONES")}; - if(str && (strcasecmp(str, "true") == 0 || strtol(str, nullptr, 0) == 1)) - ret *= 0.5f; + if(auto optval = al::getenv("__ALSOFT_HALF_ANGLE_CONES")) + { + if(strcasecmp(optval->c_str(), "true") == 0 || strtol(optval->c_str(), nullptr, 0) == 1) + ret *= 0.5f; + } return ret; } ALfloat InitZScale() { ALfloat ret{1.0f}; - const char *str{getenv("__ALSOFT_REVERSE_Z")}; - if(str && (strcasecmp(str, "true") == 0 || strtol(str, nullptr, 0) == 1)) - ret *= -1.0f; + if(auto optval = al::getenv("__ALSOFT_REVERSE_Z")) + { + if(strcasecmp(optval->c_str(), "true") == 0 || strtol(optval->c_str(), nullptr, 0) == 1) + ret *= -1.0f; + } return ret; } -- cgit v1.2.3