mirror of
git://git.openwrt.org/openwrt/openwrt.git
synced 2024-12-15 03:14:50 +00:00
base-files/functions.sh: don't use $var in $(())
It's not needed. It can also lead to subtle bugs. https://github.com/koalaman/shellcheck/wiki/Sc2004 Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
parent
1322190fd3
commit
cba5fa0352
@ -70,7 +70,7 @@ config () {
|
|||||||
local cfgtype="$1"
|
local cfgtype="$1"
|
||||||
local name="$2"
|
local name="$2"
|
||||||
|
|
||||||
export ${NO_EXPORT:+-n} CONFIG_NUM_SECTIONS=$(($CONFIG_NUM_SECTIONS + 1))
|
export ${NO_EXPORT:+-n} CONFIG_NUM_SECTIONS=$((CONFIG_NUM_SECTIONS + 1))
|
||||||
name="${name:-cfg$CONFIG_NUM_SECTIONS}"
|
name="${name:-cfg$CONFIG_NUM_SECTIONS}"
|
||||||
append CONFIG_SECTIONS "$name"
|
append CONFIG_SECTIONS "$name"
|
||||||
export ${NO_EXPORT:+-n} CONFIG_SECTION="$name"
|
export ${NO_EXPORT:+-n} CONFIG_SECTION="$name"
|
||||||
@ -93,7 +93,7 @@ list() {
|
|||||||
|
|
||||||
config_get len "$CONFIG_SECTION" "${varname}_LENGTH" 0
|
config_get len "$CONFIG_SECTION" "${varname}_LENGTH" 0
|
||||||
[ $len = 0 ] && append CONFIG_LIST_STATE "${CONFIG_SECTION}_${varname}"
|
[ $len = 0 ] && append CONFIG_LIST_STATE "${CONFIG_SECTION}_${varname}"
|
||||||
len=$(($len + 1))
|
len=$((len + 1))
|
||||||
config_set "$CONFIG_SECTION" "${varname}_ITEM$len" "$value"
|
config_set "$CONFIG_SECTION" "${varname}_ITEM$len" "$value"
|
||||||
config_set "$CONFIG_SECTION" "${varname}_LENGTH" "$len"
|
config_set "$CONFIG_SECTION" "${varname}_LENGTH" "$len"
|
||||||
append "CONFIG_${CONFIG_SECTION}_${varname}" "$value" "$LIST_SEP"
|
append "CONFIG_${CONFIG_SECTION}_${varname}" "$value" "$LIST_SEP"
|
||||||
@ -162,7 +162,7 @@ config_list_foreach() {
|
|||||||
while [ $c -le "$len" ]; do
|
while [ $c -le "$len" ]; do
|
||||||
config_get val "${section}" "${option}_ITEM$c"
|
config_get val "${section}" "${option}_ITEM$c"
|
||||||
eval "$function \"\$val\" \"\$@\""
|
eval "$function \"\$val\" \"\$@\""
|
||||||
c="$(($c + 1))"
|
c="$((c + 1))"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user