Skip to content

Commit a71cfad

Browse files
xokdviummergify[bot]
authored andcommitted
libexpr: Use table.size() instead of unnecessary loop
(cherry picked from commit d8fc55a)
1 parent 3bf71fc commit a71cfad

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/libexpr/primops/fromTOML.cc

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,7 @@ static void prim_fromTOML(EvalState & state, const PosIdx pos, Value ** args, Va
1717
switch (t.type()) {
1818
case toml::value_t::table: {
1919
auto table = toml::get<toml::table>(t);
20-
21-
size_t size = 0;
22-
for (auto & i : table) {
23-
(void) i;
24-
size++;
25-
}
26-
27-
auto attrs = state.buildBindings(size);
20+
auto attrs = state.buildBindings(table.size());
2821

2922
for (auto & elem : table) {
3023
forceNoNullByte(elem.first);

0 commit comments

Comments
 (0)