1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 19:01:16 +02:00

SymbolStr: Remove std::string conversion

This refactoring allows the symbol table to be stored as something
other than std::strings.
This commit is contained in:
Eelco Dolstra 2024-06-06 16:33:41 +02:00
parent 0363dbf2b9
commit 61080554ab
15 changed files with 37 additions and 37 deletions

View file

@ -383,7 +383,7 @@ nix_value * nix_get_attr_byidx(
try {
auto & v = check_value_in(value);
const nix::Attr & a = (*v.attrs())[i];
*name = ((const std::string &) (state->state.symbols[a.name])).c_str();
*name = state->state.symbols[a.name].c_str();
nix_gc_incref(nullptr, a.value);
state->state.forceValue(*a.value, nix::noPos);
return as_nix_value_ptr(a.value);
@ -399,7 +399,7 @@ nix_get_attr_name_byidx(nix_c_context * context, const nix_value * value, EvalSt
try {
auto & v = check_value_in(value);
const nix::Attr & a = (*v.attrs())[i];
return ((const std::string &) (state->state.symbols[a.name])).c_str();
return state->state.symbols[a.name].c_str();
}
NIXC_CATCH_ERRS_NULL
}