[72261] trunk/base/src/port/port.tcl
jberry at macports.org
jberry at macports.org
Sat Oct 9 08:41:55 PDT 2010
Revision: 72261
http://trac.macports.org/changeset/72261
Author: jberry at macports.org
Date: 2010-10-09 08:41:53 -0700 (Sat, 09 Oct 2010)
Log Message:
-----------
Simplify implementation of opUnion
Modified Paths:
--------------
trunk/base/src/port/port.tcl
Modified: trunk/base/src/port/port.tcl
===================================================================
--- trunk/base/src/port/port.tcl 2010-10-09 15:15:12 UTC (rev 72260)
+++ trunk/base/src/port/port.tcl 2010-10-09 15:41:53 UTC (rev 72261)
@@ -1312,23 +1312,14 @@
proc opUnion { a b } {
set result {}
- array unset onetime
-
- # Walk through each array, adding to result only those items that haven't
- # been added before
- foreach item $a {
+ # Walk through both lists a and b, adding to result only unique ports
+ array unset unique
+ foreach item [concat $a $b] {
array set port $item
- if {[info exists onetime($port(fullname))]} continue
- set onetime($port(fullname)) 1
+ if {[info exists unique($port(fullname))]} continue
+ set unique($port(fullname)) 1
lappend result $item
}
-
- foreach item $b {
- array set port $item
- if {[info exists onetime($port(fullname))]} continue
- set onetime($port(fullname)) 1
- lappend result $item
- }
return $result
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20101009/b8162203/attachment.html>
More information about the macports-changes
mailing list