From a85bd282d7868cd1d7b7f166a2e8d2f13abfde13 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Fri, 27 Apr 2007 10:09:14 +0000 Subject: Pounded the logging and memory tracing code into better shape. --- xpath.cc | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'xpath.cc') 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(); } -- cgit v1.2.3