From e3156d8606719a897413fe553c0a5535b17b3c92 Mon Sep 17 00:00:00 2001 From: "Bradley M. Kuhn" Date: Fri, 29 Nov 2013 16:17:28 -0500 Subject: [PATCH] MergeList function from SFLC. --- calendar-export.plx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/calendar-export.plx b/calendar-export.plx index c88469a..c86a451 100755 --- a/calendar-export.plx +++ b/calendar-export.plx @@ -52,7 +52,7 @@ # "GPLv3". If not, see . # 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) = @_;