diff options
author | Théophane Hufschmitt <theophane.hufschmitt@tweag.io> | 2022-05-16 16:36:21 +0200 |
---|---|---|
committer | Théophane Hufschmitt <theophane.hufschmitt@tweag.io> | 2022-05-16 16:36:21 +0200 |
commit | 43a2c1367292733d3e0aa2e57137c897fb66d8f6 (patch) | |
tree | 8e5dbea13dabcb753515c9e36ba21b6bc67a7895 /src/libexpr/eval-cache.cc | |
parent | e53349dd6e4a710eb7abff78722853cad418e9d2 (diff) |
Make nix::eval_cache::int_t more idiomatic
Don’t explicitely give it a constructor, but use aggregate
initialization instead (also prevents having an implicit coertion, which
is probably good here)
Diffstat (limited to 'src/libexpr/eval-cache.cc')
-rw-r--r-- | src/libexpr/eval-cache.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libexpr/eval-cache.cc b/src/libexpr/eval-cache.cc index 6b3c27fd5..6a2e775d0 100644 --- a/src/libexpr/eval-cache.cc +++ b/src/libexpr/eval-cache.cc @@ -306,7 +306,7 @@ struct AttrDb case AttrType::Bool: return {{rowId, queryAttribute.getInt(2) != 0}}; case AttrType::Int: - return {{rowId, (int_t) queryAttribute.getInt(2)}}; + return {{rowId, int_t{queryAttribute.getInt(2)}}}; case AttrType::ListOfStrings: return {{rowId, tokenizeString<std::vector<std::string>>(queryAttribute.getStr(2), "\t")}}; case AttrType::Missing: @@ -447,7 +447,7 @@ Value & AttrCursor::forceValue() else if (v.type() == nBool) cachedValue = {root->db->setBool(getKey(), v.boolean), v.boolean}; else if (v.type() == nInt) - cachedValue = {root->db->setInt(getKey(), v.integer), v.integer}; + cachedValue = {root->db->setInt(getKey(), v.integer), int_t{v.integer}}; else if (v.type() == nAttrs) ; // FIXME: do something? else @@ -651,7 +651,7 @@ NixInt AttrCursor::getInt() if (cachedValue && !std::get_if<placeholder_t>(&cachedValue->second)) { if (auto i = std::get_if<int_t>(&cachedValue->second)) { debug("using cached Integer attribute '%s'", getAttrPathStr()); - return (*i).x; + return i->x; } else throw TypeError("'%s' is not an Integer", getAttrPathStr()); } |