From 51f53afe12719513b3736a1c73e7de98d7e301ca Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 30 Jun 2019 12:00:10 -0700 Subject: Use an optional for ConfigValueInt --- Alc/alconfig.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'Alc/alconfig.cpp') diff --git a/Alc/alconfig.cpp b/Alc/alconfig.cpp index 710c790c..00643043 100644 --- a/Alc/alconfig.cpp +++ b/Alc/alconfig.cpp @@ -501,13 +501,12 @@ int ConfigValueStr(const char *devName, const char *blockName, const char *keyNa return 1; } -int ConfigValueInt(const char *devName, const char *blockName, const char *keyName, int *ret) +al::optional ConfigValueInt(const char *devName, const char *blockName, const char *keyName) { const char *val = GetConfigValue(devName, blockName, keyName, ""); - if(!val[0]) return 0; + if(!val[0]) return al::nullopt; - *ret = std::strtol(val, nullptr, 0); - return 1; + return al::optional{al::in_place, static_cast(std::strtol(val, nullptr, 0))}; } int ConfigValueUInt(const char *devName, const char *blockName, const char *keyName, unsigned int *ret) -- cgit v1.2.3