Skip to content

Commit

Permalink
src/winusb: Move util_shift_array together with all other utility fun…
Browse files Browse the repository at this point in the history
…ctions

Signed-off-by: 林博仁 <[email protected]>
  • Loading branch information
brlin-tw committed Jun 7, 2017
1 parent 04bd500 commit bc84577
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions src/winusb
Original file line number Diff line number Diff line change
Expand Up @@ -917,27 +917,6 @@ copy_filesystem_files(){
return 0
}; declare -fr copy_filesystem_files

util_shift_array(){
util_check_function_parameters_quantity 1 "${#}"

local -n array_ref="${1}"

if [ "${#array_ref[@]}" -eq 0 ]; then
printf "ERROR: array is empty!\n" 1>&2
return 1
fi

# Unset the 1st element
unset "array_ref[0]"

# Repack array if element still available in array
if [ "${#array_ref[@]}" -ne 0 ]; then
array_ref=("${array_ref[@]}")
fi

return 0
}; declare -fr util_shift_array

trap_return(){
util_check_function_parameters_quantity 1 "${#}"
local returning_function="${1}"
Expand Down Expand Up @@ -1030,6 +1009,27 @@ util_echo_with_color(){
fi
}; declare -fr util_echo_with_color

util_shift_array(){
util_check_function_parameters_quantity 1 "${#}"

local -n array_ref="${1}"

if [ "${#array_ref[@]}" -eq 0 ]; then
printf "ERROR: array is empty!\n" 1>&2
return 1
fi

# Unset the 1st element
unset "array_ref[0]"

# Repack array if element still available in array
if [ "${#array_ref[@]}" -ne 0 ]; then
array_ref=("${array_ref[@]}")
fi

return 0
}; declare -fr util_shift_array

util_is_parameter_set_and_not_empty(){
util_check_function_parameters_quantity 1 $#

Expand Down

0 comments on commit bc84577

Please sign in to comment.