summaryrefslogtreecommitdiff
path: root/src/filters.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2010-03-16 14:20:09 -0400
committerJohn Wiegley <johnw@newartisans.com>2010-03-16 14:20:09 -0400
commit2f9ea3986947c552322432449e393ee9e96c7e9e (patch)
tree3fb688b58db21866e8d20e0f532c03090db26e13 /src/filters.cc
parent3e21a171c74cca286638cecae5b050567b500789 (diff)
downloadledger-2f9ea3986947c552322432449e393ee9e96c7e9e.tar.gz
ledger-2f9ea3986947c552322432449e393ee9e96c7e9e.tar.bz2
ledger-2f9ea3986947c552322432449e393ee9e96c7e9e.zip
Short-circuit --head handler when count is reached
Diffstat (limited to 'src/filters.cc')
-rw-r--r--src/filters.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/filters.cc b/src/filters.cc
index 6c4c0f48..0c45d356 100644
--- a/src/filters.cc
+++ b/src/filters.cc
@@ -107,6 +107,9 @@ void truncate_xacts::flush()
void truncate_xacts::operator()(post_t& post)
{
+ if (completed)
+ return;
+
if (last_xact != post.xact) {
if (last_xact)
xacts_seen++;
@@ -114,8 +117,11 @@ void truncate_xacts::operator()(post_t& post)
}
if (tail_count == 0 && head_count > 0 &&
- static_cast<int>(xacts_seen) >= head_count)
+ static_cast<int>(xacts_seen) >= head_count) {
+ flush();
+ completed = true;
return;
+ }
posts.push_back(&post);
}