aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/references.cc
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-05-01 20:10:00 +0200
committereldritch horrors <pennae@lix.systems>2024-07-06 12:36:37 +0200
commit5af76dee371ea5fa1eb72141370fdf18851d67c7 (patch)
treea51cc0348910a8fce0df02c132efe9a438ddd911 /src/libutil/references.cc
parent4162a66cee97ec16c88d991ef9a6d9baa3740053 (diff)
libutil: turn HashModuloSink into a free function
Change-Id: I5878007502fa68c2816a0f4c61f7d0e60bdde702
Diffstat (limited to 'src/libutil/references.cc')
-rw-r--r--src/libutil/references.cc15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/libutil/references.cc b/src/libutil/references.cc
index 6189f69b9..249c78bf7 100644
--- a/src/libutil/references.cc
+++ b/src/libutil/references.cc
@@ -109,19 +109,12 @@ void RewritingSink::flush()
prev.clear();
}
-HashModuloSink::HashModuloSink(HashType ht, const std::string & modulus)
- : hashSink(ht)
- , rewritingSink(modulus, std::string(modulus.size(), 0), hashSink)
+HashResult computeHashModulo(HashType ht, const std::string & modulus, Source & source)
{
-}
+ HashSink hashSink(ht);
+ RewritingSink rewritingSink(modulus, std::string(modulus.size(), 0), hashSink);
-void HashModuloSink::operator () (std::string_view data)
-{
- rewritingSink(data);
-}
-
-HashResult HashModuloSink::finish()
-{
+ source.drainInto(rewritingSink);
rewritingSink.flush();
/* Hash the positions of the self-references. This ensures that a