1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-09 12:06:01 +01:00

libexpr: Use table.size() instead of unnecessary loop

(cherry picked from commit d8fc55a46e)
This commit is contained in:
Sergei Zimmerman 2025-08-12 14:58:01 +03:00
parent 219b85478a
commit 4ba8f167ff
No known key found for this signature in database

View file

@ -17,14 +17,7 @@ static void prim_fromTOML(EvalState & state, const PosIdx pos, Value ** args, Va
switch (t.type()) { switch (t.type()) {
case toml::value_t::table: { case toml::value_t::table: {
auto table = toml::get<toml::table>(t); auto table = toml::get<toml::table>(t);
auto attrs = state.buildBindings(table.size());
size_t size = 0;
for (auto & i : table) {
(void) i;
size++;
}
auto attrs = state.buildBindings(size);
for (auto & elem : table) { for (auto & elem : table) {
forceNoNullByte(elem.first); forceNoNullByte(elem.first);