Add new convenience pool allocators for arbitrary types, and use them to keep all TSymbol content in the pool, so they don't have to be deleted.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24148 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich
2013-11-20 18:37:12 +00:00
parent e1dba1b59f
commit 23bcc02a20
5 changed files with 24 additions and 13 deletions

View File

@@ -83,7 +83,7 @@ public:
POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
explicit TSymbol(const TString *n) : name(n), writable(true), numExtensions(0), extensions(0) { }
virtual TSymbol* clone() const = 0;
virtual ~TSymbol() { delete [] extensions; }
virtual ~TSymbol() { } // rely on all symbol owned memory coming from the pool
virtual const TString& getName() const { return *name; }
virtual void changeName(const TString* newName) { name = newName; }
@@ -100,8 +100,9 @@ public:
virtual void setExtensions(int num, const char* const exts[])
{
assert(extensions == 0);
assert(num > 0);
numExtensions = num;
extensions = new const char*[numExtensions];
extensions = NewPoolObject(exts[0], num);
for (int e = 0; e < num; ++e)
extensions[e] = exts[e];
}