MergeList function from SFLC.

This commit is contained in:
Bradley M. Kuhn 2013-11-29 16:17:28 -05:00
parent 8f9ce9b676
commit e3156d8606

View file

@ -52,7 +52,7 @@
# "GPLv3". If not, see <http://www.gnu.org/licenses/>.
# The functions DoLog, BinarySearchForTZEntry, PrivatizeMergeAndTZIcalFile,
# BuildTZList, PrivacyFilterICalFiles, and FilterEmacsToICal material
# BuildTZList, MergeLists, PrivacyFilterICalFiles, and FilterEmacsToICal material
# copyrighted and licensed as below:
# Copyright © 2006 Software Freedom Law Center, Inc.
@ -223,6 +223,19 @@ sub BinarySearchForTZEntry {
return $tzList->[$final]; # not found, go down one lower
}
###############################################################################
# Take a list of keys and a list of values and insersperse them and
# return the result
sub MergeLists {
my ($keys, $values) = @_;
DieLog("Length mismatch", $LOCK_CLEANUP_CODE) unless @$keys == @$values;
# Add the argument names to the values
my @result;
for (my $i = 0; $i < @$keys; $i++) {
push @result, $keys->[$i] => $values->[$i];
}
return @result;
}
###############################################################################
sub BuildTZList ($$$) {
my($user, $pubEmacsFile, $privEmacsFile) = @_;