diff options
author | Roberto Raggi <roberto.raggi@nokia.com> | 2009-10-22 16:46:26 +0200 |
---|---|---|
committer | Roberto Raggi <roberto.raggi@nokia.com> | 2009-10-22 16:48:06 +0200 |
commit | 2a7fa04101bf487f4fd6dd04297573f62157d41a (patch) | |
tree | 3707690d1ca2ec3fbde9cfd1be0d1964e9fa91a3 /src/shared/cplusplus/MemoryPool.h | |
parent | 8175e4e4c62bb5a587329ca5bb5c4c35508370d4 (diff) | |
download | qt-creator-2a7fa04101bf487f4fd6dd04297573f62157d41a.tar.gz |
Released the memory allocated in the memory pool when backtracking from Parser::parseTemplateId().
Diffstat (limited to 'src/shared/cplusplus/MemoryPool.h')
-rw-r--r-- | src/shared/cplusplus/MemoryPool.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/shared/cplusplus/MemoryPool.h b/src/shared/cplusplus/MemoryPool.h index e0f1ff8701..5b6fae925f 100644 --- a/src/shared/cplusplus/MemoryPool.h +++ b/src/shared/cplusplus/MemoryPool.h @@ -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); |