Released the memory allocated in the memory pool when backtracking from Parser::parseTemplateId().

This commit is contained in:
Roberto Raggi
2009-10-22 16:46:26 +02:00
parent 8175e4e4c6
commit 2a7fa04101
4 changed files with 64 additions and 0 deletions

View File

@@ -79,6 +79,22 @@ public:
return allocate_helper(size);
}
struct State
{
char *ptr;
char *end;
int blockCount;
inline bool isValid() const
{ return ptr != 0; }
inline State(char *ptr = 0, int blockCount = 0)
: ptr(ptr), blockCount(blockCount) {}
};
State state() const;
void rewind(const State &state);
private:
void *allocate_helper(size_t size);