pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk/pkgformat/pkg reduce-depends.awk: Avoid "delete arr...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/959d842be958
branches:  trunk
changeset: 369589:959d842be958
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Sun Oct 01 22:58:19 2017 +0000

description:
reduce-depends.awk: Avoid "delete array" statement for portability.

POSIX awk doesn't allow "delete array" to delete an entire array.
For portability, one must delete each element of the array.

diffstat:

 mk/pkgformat/pkg/reduce-depends.awk |  15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diffs (38 lines):

diff -r 0af0a82a7f3b -r 959d842be958 mk/pkgformat/pkg/reduce-depends.awk
--- a/mk/pkgformat/pkg/reduce-depends.awk       Sun Oct 01 19:05:40 2017 +0000
+++ b/mk/pkgformat/pkg/reduce-depends.awk       Sun Oct 01 22:58:19 2017 +0000
@@ -1,6 +1,6 @@
 #!/usr/bin/awk -f
 #
-# $NetBSD: reduce-depends.awk,v 1.6 2017/10/01 17:57:18 jlam Exp $
+# $NetBSD: reduce-depends.awk,v 1.7 2017/10/01 22:58:19 jlam Exp $
 #
 # Copyright (c) 2006-2017 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -82,6 +82,11 @@
        return 0
 }
 
+function delete_array(array,   key)
+{
+       for (key in array) delete array[key]
+}
+
 ###
 # get_endpoint(cmp, patterns)
 #
@@ -266,10 +271,10 @@
                        if (!(depend in reduced)) reduced[depend] = ++N
                }
 
-               delete lt_patterns
-               delete le_patterns
-               delete gt_patterns
-               delete ge_patterns
+               delete_array(lt_patterns)
+               delete_array(le_patterns)
+               delete_array(gt_patterns)
+               delete_array(ge_patterns)
        }
 
        # Output reduced dependencies.



Home | Main Index | Thread Index | Old Index