]> xenbits.xensource.com Git - osstest.git/commitdiff
history reporting (nfc): Make cacheable_fn work without cache
authorIan Jackson <ian.jackson@eu.citrix.com>
Wed, 12 Aug 2020 09:55:43 +0000 (10:55 +0100)
committerIan Jackson <ian.jackson@eu.citrix.com>
Wed, 19 Aug 2020 10:41:18 +0000 (11:41 +0100)
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 <ian.jackson@eu.citrix.com>
Osstest/HistoryReport.pm

index 695d744a580f50624a942753fc80ac15a08cfd36..5d2c83b7a5058b3f81403b73f30202aab75c2e80 100644 (file)
@@ -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}++;