Skip to content

Commit

Permalink
define-append now ignores empty values
Browse files Browse the repository at this point in the history
e.g. define-append ABC 1 "" 2
will result in ABC="1 2"

Signed-off-by: Steve Bennett <steveb@workware.net.au>
  • Loading branch information
msteveb committed Aug 4, 2018
1 parent c57acd2 commit 01c0e92
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions autosetup
Expand Up @@ -709,6 +709,9 @@ proc define-append {name args} {
if {[get-define $name ""] ne ""} {
# Avoid duplicates
foreach arg $args {
if {$arg eq ""} {
continue
}
set found 0
foreach str [split $::define($name) " "] {
if {$str eq $arg} {
Expand Down
7 changes: 5 additions & 2 deletions testsuite/auto.def
Expand Up @@ -81,8 +81,11 @@ test define-1.6 {define-append} {
define e {2 2}

# define-append will append with a space, omitting duplicates but not removing
define-append a 1 2
define-append b 1 2
# and will ignore empty values
define-append a 1 "" 2
define-append a ""
define-append a
define-append b "" 1 2
define-append c 1 2
define-append d 1 2
define-append e 1 2
Expand Down

0 comments on commit 01c0e92

Please sign in to comment.