summaryrefslogtreecommitdiff
path: root/src/filters.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/filters.cc')
-rw-r--r--src/filters.cc27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/filters.cc b/src/filters.cc
index 3071a951..ea3ed99d 100644
--- a/src/filters.cc
+++ b/src/filters.cc
@@ -61,22 +61,22 @@ void truncate_xacts::flush()
if (! posts.size())
return;
- xact_t * last_xact = (*posts.begin())->xact;
+ xact_t * xact = (*posts.begin())->xact;
int l = 0;
foreach (post_t * post, posts)
- if (last_xact != post->xact) {
+ if (xact != post->xact) {
l++;
- last_xact = post->xact;
+ xact = post->xact;
}
l++;
- last_xact = (*posts.begin())->xact;
+ xact = (*posts.begin())->xact;
int i = 0;
foreach (post_t * post, posts) {
- if (last_xact != post->xact) {
- last_xact = post->xact;
+ if (xact != post->xact) {
+ xact = post->xact;
i++;
}
@@ -103,6 +103,21 @@ void truncate_xacts::flush()
item_handler<post_t>::flush();
}
+void truncate_xacts::operator()(post_t& post)
+{
+ if (last_xact != post.xact) {
+ if (last_xact)
+ xacts_seen++;
+ last_xact = post.xact;
+ }
+
+ if (tail_count == 0 && head_count > 0 &&
+ static_cast<int>(xacts_seen) >= head_count)
+ return;
+
+ posts.push_back(&post);
+}
+
void set_account_value::operator()(post_t& post)
{
account_t * acct = post.reported_account();