mirror of
https://github.com/NixOS/nix.git
synced 2025-11-09 20:16:03 +01:00
libexpr: Use table.size() instead of unnecessary loop
(cherry picked from commit d8fc55a46e)
This commit is contained in:
parent
219b85478a
commit
4ba8f167ff
1 changed files with 1 additions and 8 deletions
|
|
@ -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);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue