aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/helpers.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Alc/helpers.cpp')
-rw-r--r--Alc/helpers.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/Alc/helpers.cpp b/Alc/helpers.cpp
index beee4bff..2db544b8 100644
--- a/Alc/helpers.cpp
+++ b/Alc/helpers.cpp
@@ -310,9 +310,11 @@ void FPUCtl::leave() noexcept
#ifdef _WIN32
-PathNamePair GetProcBinary()
+const PathNamePair &GetProcBinary()
{
- PathNamePair ret;
+ static PathNamePair ret;
+ if(!ret.fname.empty() || !ret.path.empty())
+ return ret;
al::vector<WCHAR> fullpath(256);
DWORD len;
@@ -477,11 +479,13 @@ void SetRTPriority(void)
#else
-PathNamePair GetProcBinary()
+const PathNamePair &GetProcBinary()
{
- PathNamePair ret;
- al::vector<char> pathname;
+ static PathNamePair ret;
+ if(!ret.fname.empty() || !ret.path.empty())
+ return ret;
+ al::vector<char> pathname;
#ifdef __FreeBSD__
size_t pathlen;
int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };