scripts: gen_dts_cmake: a small optimization

Using edt.chosen_nodes looks like a simple attribute lookup, but it's
actually calling a property that will create a new list of chosen
nodes every time. Apply a small optimization by only creating the list
once.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
Martí Bolívar 2021-11-19 12:34:12 -08:00 committed by Christopher Friedt
commit b65b49bef6

View file

@ -83,8 +83,9 @@ def main():
# macros.bnf for C macros. # macros.bnf for C macros.
cmake_props = [] cmake_props = []
for node in edt.chosen_nodes: chosen_nodes = edt.chosen_nodes
path = edt.chosen_nodes[node].path for node in chosen_nodes:
path = chosen_nodes[node].path
cmake_props.append(f'"DT_CHOSEN|{node}" "{path}"') cmake_props.append(f'"DT_CHOSEN|{node}" "{path}"')
for node in edt.nodes: for node in edt.nodes: