Skip to content

Commit b3c1b70

Browse files
authored
Merge pull request NixOS#13345 from xokdvium/use-value-getters
libexpr: Use value getters (NFC)
2 parents c5b1be4 + 408873c commit b3c1b70

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/libexpr/eval.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ std::string showType(const Value & v)
126126
#pragma GCC diagnostic push
127127
#pragma GCC diagnostic ignored "-Wswitch-enum"
128128
switch (v.internalType) {
129-
case tString: return v.payload.string.context ? "a string with context" : "a string";
129+
case tString: return v.context() ? "a string with context" : "a string";
130130
case tPrimOp:
131-
return fmt("the built-in function '%s'", std::string(v.payload.primOp->name));
131+
return fmt("the built-in function '%s'", std::string(v.primOp()->name));
132132
case tPrimOpApp:
133133
return fmt("the partially applied built-in function '%s'", v.primOpAppPrimOp()->name);
134134
case tExternal: return v.external()->showType();
@@ -2297,8 +2297,8 @@ std::string_view EvalState::forceString(Value & v, const PosIdx pos, std::string
22972297

22982298
void copyContext(const Value & v, NixStringContext & context, const ExperimentalFeatureSettings & xpSettings)
22992299
{
2300-
if (v.payload.string.context)
2301-
for (const char * * p = v.payload.string.context; *p; ++p)
2300+
if (v.context())
2301+
for (const char * * p = v.context(); *p; ++p)
23022302
context.insert(NixStringContextElem::parse(*p, xpSettings));
23032303
}
23042304

src/libexpr/include/nix/expr/symbol-table.hh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class SymbolValue : protected Value
2929
public:
3030
operator std::string_view() const noexcept
3131
{
32-
return {payload.string.c_str, size_};
32+
return {c_str(), size_};
3333
}
3434
};
3535

@@ -122,7 +122,7 @@ public:
122122
[[gnu::always_inline]]
123123
const char * c_str() const noexcept
124124
{
125-
return s->payload.string.c_str;
125+
return s->c_str();
126126
}
127127

128128
[[gnu::always_inline]]

0 commit comments

Comments
 (0)