summaryrefslogtreecommitdiff
path: root/xpath.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2007-04-27 10:09:14 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 03:38:32 -0400
commita85bd282d7868cd1d7b7f166a2e8d2f13abfde13 (patch)
tree1682fa1da36756eabbe04ab2df1b60e557dbfee8 /xpath.cc
parentd0e9822ed16cb36de4cb1171a89d4049c615f1a0 (diff)
downloadfork-ledger-a85bd282d7868cd1d7b7f166a2e8d2f13abfde13.tar.gz
fork-ledger-a85bd282d7868cd1d7b7f166a2e8d2f13abfde13.tar.bz2
fork-ledger-a85bd282d7868cd1d7b7f166a2e8d2f13abfde13.zip
Pounded the logging and memory tracing code into better shape.
Diffstat (limited to 'xpath.cc')
-rw-r--r--xpath.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/xpath.cc b/xpath.cc
index 39e1d091..574a6ac8 100644
--- a/xpath.cc
+++ b/xpath.cc
@@ -10,9 +10,20 @@ namespace ledger {
namespace xml {
#ifndef THREADSAFE
-xpath_t::token_t xpath_t::lookahead;
+xpath_t::token_t * xpath_t::lookahead = NULL;
#endif
+void xpath_t::initialize()
+{
+ lookahead = new xpath_t::token_t;
+}
+
+void xpath_t::shutdown()
+{
+ delete lookahead;
+ lookahead = NULL;
+}
+
void xpath_t::token_t::parse_ident(std::istream& in)
{
if (in.eof()) {
@@ -1130,9 +1141,17 @@ xpath_t::parse_expr(std::istream& in, unsigned short tflags) const
if (use_lookahead) {
use_lookahead = false;
+#ifdef THREADSAFE
lookahead.rewind(in);
+#else
+ lookahead->rewind(in);
+#endif
}
+#ifdef THREADSAFE
lookahead.clear();
+#else
+ lookahead->clear();
+#endif
return node.release();
}