From fd3447b51ef1d214fb046cfcb77dbc11f7cfcbae Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Thu, 31 Aug 2017 09:54:24 +0000 Subject: [PATCH] mpers.awk: declare local variables consistently * mpers.awk (compare_indices): Make c1 and c2 variables local. (enter): Make item variable local. (what_is): Make loc_diff, returned_size, and to_return local. --- mpers.awk | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/mpers.awk b/mpers.awk index 92a1dfa0..705ee642 100644 --- a/mpers.awk +++ b/mpers.awk @@ -27,7 +27,9 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -function compare_indices(i1, v1, i2, v2) { +function compare_indices(i1, v1, i2, v2, \ + c1, c2) +{ c1 = strtonum(sprintf("%s", i1)) c2 = strtonum(sprintf("%s", i2)) if (c1 < c2) @@ -53,7 +55,8 @@ function array_seq(array_idx) array[array_idx]["seq"] = index_seq return index_seq } -function enter(array_idx) +function enter(array_idx, + item) { if (array_idx in called) { printf("%s: index loop detected:", FILENAME) > "/dev/stderr" @@ -78,8 +81,9 @@ function update_upper_bound(idx, val, \ array[idx]["count"] = count * val array[idx]["upper_bound"] = array[idx]["upper_bound"] "[" val "]" } -function what_is(what_idx, type_idx, special, item, \ - location, prev_location, prev_returned_size) +function what_is(what_idx, \ + item, loc_diff, location, prev_location, prev_returned_size, \ + returned_size, special, to_return, type_idx) { enter(what_idx) special = array_get(what_idx, "special") -- 2.40.0