Skip to content

Commit e888ff5

Browse files
committed
fix: Properly unset incremenet varaibles
1 parent befa966 commit e888ff5

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

pkg/src/parse.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ bash_object.parse_querytree() {
1717
--advanced)
1818
flag_parser_type='advanced'
1919
shift ;;
20-
esac done
20+
esac done; unset -v arg
2121

2222
local querytree="$1"
2323

@@ -180,7 +180,7 @@ bash_object.parse_virtual_object() {
180180
fi
181181

182182
# Parse info about the virtual object
183-
local vmd_dtype=
183+
local vmd= vmd_key= vmd_value= vmd_dtype=
184184
while IFS= read -rd \; vmd; do
185185
if [ -z "$vmd" ]; then
186186
continue

pkg/src/traverse-get.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ bash_object.traverse-get() {
1111
local flag_as_what=
1212
local -a args=()
1313

14+
local arg=
1415
for arg; do case $arg in
1516
--ref)
1617
if [ -n "$flag_as_what" ]; then
@@ -32,7 +33,7 @@ bash_object.traverse-get() {
3233
*)
3334
args+=("$arg")
3435
;;
35-
esac done
36+
esac done; unset -v arg
3637

3738
if [ -z "$flag_as_what" ]; then
3839
bash_object.util.die 'ERROR_ARGUMENTS_INVALID' "Must pass either the '--ref' or '--value' flag"
@@ -75,6 +76,7 @@ bash_object.traverse-get() {
7576
*']'*) bash_object.parse_querytree --advanced "$querytree" ;;
7677
*) bash_object.parse_querytree --simple "$querytree" ;;
7778
esac
79+
local i=
7880
for ((i=0; i<${#REPLIES[@]}; i++)); do
7981
local key="${REPLIES[$i]}"
8082

pkg/src/traverse-set.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ bash_object.traverse-set() {
99
local flag_pass_by_what=
1010
local -a args=()
1111

12+
local arg=
1213
for arg; do case $arg in
1314
--ref)
1415
if [ -n "$flag_pass_by_what" ]; then
@@ -34,7 +35,7 @@ bash_object.traverse-set() {
3435
esac; if ! shift; then
3536
bash_object.util.die 'ERROR_INTERNAL' 'Shift failed, but was expected to succeed'
3637
return
37-
fi; done
38+
fi; done; unset -v arg
3839

3940
if [ -z "$flag_pass_by_what" ]; then
4041
bash_object.util.die 'ERROR_ARGUMENTS_INVALID' "Must pass either the '--ref' or '--value' flag"
@@ -216,6 +217,7 @@ bash_object.traverse-set() {
216217
*']'*) bash_object.parse_querytree --advanced "$querytree" ;;
217218
*) bash_object.parse_querytree --simple "$querytree" ;;
218219
esac
220+
local i=
219221
for ((i=0; i<${#REPLIES[@]}; i++)); do
220222
local key="${REPLIES[$i]}"
221223

0 commit comments

Comments
 (0)