diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2021-01-08 12:22:21 +0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2021-01-08 12:22:21 +0100 |
commit | 6548b89cc4eb214cb4632fd4332c610f2d1f0a9d (patch) | |
tree | 1d9044a0f0602993c5a538ce2231d8d569aeb2a5 /src/libexpr/get-drvs.cc | |
parent | 29a445840a4f01dfb1533806f8dfc28f7dc4bee9 (diff) |
string2Int(): Return std::optional
Diffstat (limited to 'src/libexpr/get-drvs.cc')
-rw-r--r-- | src/libexpr/get-drvs.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libexpr/get-drvs.cc b/src/libexpr/get-drvs.cc index 32c115c12..1a3990ea1 100644 --- a/src/libexpr/get-drvs.cc +++ b/src/libexpr/get-drvs.cc @@ -214,8 +214,8 @@ NixInt DrvInfo::queryMetaInt(const string & name, NixInt def) if (v->type() == nString) { /* Backwards compatibility with before we had support for integer meta fields. */ - NixInt n; - if (string2Int(v->string.s, n)) return n; + if (auto n = string2Int<NixInt>(v->string.s)) + return *n; } return def; } @@ -228,8 +228,8 @@ NixFloat DrvInfo::queryMetaFloat(const string & name, NixFloat def) if (v->type() == nString) { /* Backwards compatibility with before we had support for float meta fields. */ - NixFloat n; - if (string2Float(v->string.s, n)) return n; + if (auto n = string2Float<NixFloat>(v->string.s)) + return *n; } return def; } |