diff options
author | John Wiegley <johnw@newartisans.com> | 2007-04-27 10:09:14 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-04-13 03:38:32 -0400 |
commit | a85bd282d7868cd1d7b7f166a2e8d2f13abfde13 (patch) | |
tree | 1682fa1da36756eabbe04ab2df1b60e557dbfee8 /xpath.cc | |
parent | d0e9822ed16cb36de4cb1171a89d4049c615f1a0 (diff) | |
download | fork-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.cc | 21 |
1 files changed, 20 insertions, 1 deletions
@@ -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(); } |