aboutsummaryrefslogtreecommitdiffstats
path: root/alc/alconfig.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-01-13 01:25:20 -0800
committerChris Robinson <[email protected]>2023-01-13 01:25:20 -0800
commit974d1b9e6d174f1680604b2872911110f6a0e41c (patch)
tree8dd9517957717b82977e433276a14b9892b3d563 /alc/alconfig.cpp
parent97f2c28ddd79474e163f62d666fc8ce555f31e0f (diff)
Avoid unnecessary uses of make_optional
Diffstat (limited to 'alc/alconfig.cpp')
-rw-r--r--alc/alconfig.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/alc/alconfig.cpp b/alc/alconfig.cpp
index 7c1eec6d..14b2580d 100644
--- a/alc/alconfig.cpp
+++ b/alc/alconfig.cpp
@@ -486,36 +486,36 @@ void ReadALConfig()
al::optional<std::string> ConfigValueStr(const char *devName, const char *blockName, const char *keyName)
{
if(const char *val{GetConfigValue(devName, blockName, keyName)})
- return al::make_optional<std::string>(val);
+ return val;
return al::nullopt;
}
al::optional<int> ConfigValueInt(const char *devName, const char *blockName, const char *keyName)
{
if(const char *val{GetConfigValue(devName, blockName, keyName)})
- return al::make_optional(static_cast<int>(std::strtol(val, nullptr, 0)));
+ return static_cast<int>(std::strtol(val, nullptr, 0));
return al::nullopt;
}
al::optional<unsigned int> ConfigValueUInt(const char *devName, const char *blockName, const char *keyName)
{
if(const char *val{GetConfigValue(devName, blockName, keyName)})
- return al::make_optional(static_cast<unsigned int>(std::strtoul(val, nullptr, 0)));
+ return static_cast<unsigned int>(std::strtoul(val, nullptr, 0));
return al::nullopt;
}
al::optional<float> ConfigValueFloat(const char *devName, const char *blockName, const char *keyName)
{
if(const char *val{GetConfigValue(devName, blockName, keyName)})
- return al::make_optional(std::strtof(val, nullptr));
+ return std::strtof(val, nullptr);
return al::nullopt;
}
al::optional<bool> ConfigValueBool(const char *devName, const char *blockName, const char *keyName)
{
if(const char *val{GetConfigValue(devName, blockName, keyName)})
- return al::make_optional(al::strcasecmp(val, "on") == 0 || al::strcasecmp(val, "yes") == 0
- || al::strcasecmp(val, "true")==0 || atoi(val) != 0);
+ return al::strcasecmp(val, "on") == 0 || al::strcasecmp(val, "yes") == 0
+ || al::strcasecmp(val, "true")==0 || atoi(val) != 0;
return al::nullopt;
}