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 --- al/state.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'al') diff --git a/al/state.cpp b/al/state.cpp index 8c95c22f..884aa9d2 100644 --- a/al/state.cpp +++ b/al/state.cpp @@ -42,6 +42,7 @@ #include "event.h" #include "inprogext.h" #include "opthelpers.h" +#include "strutils.h" namespace { @@ -73,8 +74,8 @@ constexpr ALchar alBSinc24Resampler[] = "23rd order Sinc"; extern "C" AL_API const ALchar* AL_APIENTRY alsoft_get_version(void) START_API_FUNC { - const char *spoof{getenv("ALSOFT_SPOOF_VERSION")}; - if(spoof && spoof[0] != '\0') return spoof; + static const auto spoof = al::getenv("ALSOFT_SPOOF_VERSION"); + if(spoof) return spoof->c_str(); return ALSOFT_VERSION; } END_API_FUNC -- cgit v1.2.3