summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/accum.cc3
-rw-r--r--src/accum.h8
-rw-r--r--src/draft.cc4
3 files changed, 12 insertions, 3 deletions
diff --git a/src/accum.cc b/src/accum.cc
index 8f3d5185..0187995e 100644
--- a/src/accum.cc
+++ b/src/accum.cc
@@ -35,6 +35,9 @@
namespace ledger {
+straccstream _accum;
+std::ostringstream _accum_buffer;
+
std::streamsize straccbuf::xsputn(const char * s, std::streamsize num)
{
if (index == 0) {
diff --git a/src/accum.h b/src/accum.h
index 236a7714..411bcbe6 100644
--- a/src/accum.h
+++ b/src/accum.h
@@ -83,6 +83,14 @@ public:
#define ACCUM(obj) (static_cast<const straccstream&>(obj).str())
+extern straccstream _accum;
+extern std::ostringstream _accum_buffer;
+
+#define STR(msg) \
+ ((_accum_buffer << ACCUM(_accum << msg)), \
+ _accum.clear(), \
+ _accum_buffer.str())
+
} // namespace ledger
#endif // _ACCUM_H
diff --git a/src/draft.cc b/src/draft.cc
index 2b8b45f7..9f9ec6e8 100644
--- a/src/draft.cc
+++ b/src/draft.cc
@@ -67,10 +67,8 @@ void draft_t::xact_template_t::dump(std::ostream& out) const
<< std::endl;
} else {
foreach (const post_template_t& post, posts) {
- straccstream accum;
out << std::endl
- << ACCUM(accum << _("[Posting \"%1\"]")
- << (post.from ? _("from") : _("to")))
+ << STR(_("[Posting \"%1\"]") << (post.from ? _("from") : _("to")))
<< std::endl;
if (post.account_mask)