changeset 485:7e319d23cd8a

Docs: warn if the length of arrays are changed while calling array_for_each()
author Franz Glasner <fzglas.hg@dom66.de>
date Thu, 29 Aug 2024 15:12:10 +0200
parents 5d43c68bd1e9
children 0f5b4e8388a4
files share/local-bsdtools/array.sh
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/share/local-bsdtools/array.sh	Thu Aug 29 15:11:29 2024 +0200
+++ b/share/local-bsdtools/array.sh	Thu Aug 29 15:12:10 2024 +0200
@@ -214,6 +214,12 @@
 #:   $1 (str): The name of an existing array.
 #:   $2 (str): The name of a function to be called with three arguments.
 #:
+#: Warning:
+#:   If the number of elements changes while being in `array_for_each` then
+#:   the behaviour is undefined.
+#:   The current implementation determines the length of the array once
+#:   at the start of execution.
+#:
 array_for_each() {
     local _name _cb