aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Robbins <contact@andrewrobbins.info>2019-03-28 15:23:53 -0400
committerAndrew Robbins <contact@andrewrobbins.info>2019-03-28 15:23:53 -0400
commitee4b0d7419974b0605bed80814d3d22478edf98d (patch)
tree2bee577451ead1f2065b78605f201d4a87c05a84
parent335da90531ea47d4f4a7c515503978f7af456439 (diff)
downloadlibrebootfr-ee4b0d7419974b0605bed80814d3d22478edf98d.tar.gz
librebootfr-ee4b0d7419974b0605bed80814d3d22478edf98d.zip
libs/project: Set max loop iteration in for loop
-rwxr-xr-xlibs/project14
1 files changed, 5 insertions, 9 deletions
diff --git a/libs/project b/libs/project
index 70a76d71..083cfcd8 100755
--- a/libs/project
+++ b/libs/project
@@ -75,10 +75,9 @@ project_dependencies_check() {
local -a dependencies
mapfile -t dependencies < <(project_dependencies "$project" "$@")
- local -i count=${#dependencies[@]}
local -i missing=0
- for ((i = 0; i < count; i++)); do
+ for ((i = 0, nodeps = ${#dependencies[@]}; i < nodeps; ++i)); do
local -a dependency=(${dependencies[i]})
project_check "${dependency[0]}" || let missing++
@@ -94,14 +93,13 @@ project_dependencies_sources_check() {
local -a dependencies
mapfile -t dependencies < <(project_dependencies "$project" "$@")
- local -i count=${#dependencies[@]}
local -i missing=0
- for ((i = 0; i < count; i++)); do
+ for ((i = 0, nodeps = ${#dependencies[@]}; i < nodeps; ++i)); do
local -a dependency=(${dependencies[i]})
- project_sources_directory_filled_check "${dependency[0]}" \
- || let missing++
+ project_sources_directory_filled_check "${dependency[0]}" ||
+ let missing++
done
return $missing
@@ -115,9 +113,7 @@ project_dependencies_action_arguments() {
local -a dependencies
mapfile -t dependencies < <(project_dependencies "$project" "$@")
- local -i count=${#dependencies[@]}
-
- for ((i = 0; i < count; i++)); do
+ for ((i = 0, nodeps = ${#dependencies[@]}; i < nodeps; ++i)); do
local -a dependency=(${dependencies[i]})
if project_function_check "${dependency[0]}" "$action"; then