From eb642d3400a5b4f21dab5a67e19d47369f26332e Mon Sep 17 00:00:00 2001 From: nkorslund Date: Sat, 19 Jul 2008 21:52:05 +0000 Subject: [PATCH] Very minor changes. git-svn-id: https://openmw.svn.sourceforge.net/svnroot/openmw/trunk@30 ea6a568a-9f4f-0410-981a-c910a81bb256 --- monster/util/aa.d | 2 +- nif/record.d | 8 ++++---- util/regions.d | 15 +-------------- 3 files changed, 6 insertions(+), 19 deletions(-) diff --git a/monster/util/aa.d b/monster/util/aa.d index fbb37819c..2d10f6809 100644 --- a/monster/util/aa.d +++ b/monster/util/aa.d @@ -228,7 +228,7 @@ struct HashTable(Key, Value, Alloc = GCAlloc, Hash = DefHash, } // Look up a value. If found return true, otherwise false. - bool inList(Key k) { return lookup(k) != null; } + bool inList(Key k) { return lookupKey(k) != null; } // Look up a value. If found return pointer, otherwise null. Value* lookup(Key k) diff --git a/nif/record.d b/nif/record.d index 61c08efe6..d93213a13 100644 --- a/nif/record.d +++ b/nif/record.d @@ -64,12 +64,12 @@ abstract class Record } public: + // Allocate objects of this class (and all subclasses) in the + // nifRegion. This means we can allocate and deallocate the entire + // nif tree very quickly, without involving the GC, and with zero + // chance of memory leaks or heap fragmentation. new(uint sz) { - // After eliminating all GC dependence, this is no longer - // needed. - //return nifRegion.allocateGC(sz).ptr; - return nifRegion.allocate(sz).ptr; } diff --git a/util/regions.d b/util/regions.d index 802e8e719..13ac63922 100644 --- a/util/regions.d +++ b/util/regions.d @@ -37,14 +37,6 @@ class RegionManagerException : Exception { super( format("Memory Region Manager '%s': %s", name, msg ) ); } } -// I tried this as an inner class, and it didn't even remotely work. I -// think inner class support in DMD sucks quite a bit. Works ok now -// (but still had some problems - template support in general is still -// pretty patchy.) - -// UPDATE: The above comment was written a long time ago, it might -// work now. But if it ain't broke, don't fix it. - // A resizable array using a region for memory allocation. These can // safely be resized back and forth without wasting large amounts of // memory. @@ -179,7 +171,7 @@ class RegionManager // Use a default buffer size of one meg. Might change later. const uint defaultBufferSize = 1024*1024; - // The size to use for new buffer. + // The size to use for new buffers. uint bufferSize; // Current amount of space that is 'lost' in unused end-of-buffer @@ -205,11 +197,6 @@ class RegionManager // large enough to prevent this from being necessary in most cases. void nextBuffer() { - /* - if(currentBuffer != 0) - writefln("WARNING: adding new buffer, number ", currentBuffer); - */ - // We should never have to increase the number of buffers! if(currentBuffer >= buffers.length) fail("Out of buffers");