From cf6c9fab7ad53cea664c2bca72af401b41305410 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 12 Aug 2020 10:55:43 +0100 Subject: [PATCH] history reporting (nfc): Make cacheable_fn work without cache This would allow us to use this in call sites without a cache. I changed my mind about the code that prompted this, but it still seems plausibly useful, so I'm keeping this commit. Signed-off-by: Ian Jackson --- Osstest/HistoryReport.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/Osstest/HistoryReport.pm b/Osstest/HistoryReport.pm index 695d744..5d2c83b 100644 --- a/Osstest/HistoryReport.pm +++ b/Osstest/HistoryReport.pm @@ -99,6 +99,7 @@ sub key ($) { sub cacheable_fn ($$$) { my ($jr, $cachekey, $fn) = @_; + return $fn->() if !defined $cachekey; $cachekey = '%'.$cachekey; my $cached = $jr->{$cachekey}; $q_count{$cachekey}++; -- 2.39.5