diff options
-rw-r--r-- | src/hashtable.cpp | 5 | ||||
-rw-r--r-- | src/hashtable.h | 7 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/hashtable.cpp b/src/hashtable.cpp index d3f9f26..8a31f57 100644 --- a/src/hashtable.cpp +++ b/src/hashtable.cpp | |||
@@ -31,6 +31,11 @@ void HashTable::set( int j, const void *newID, const void *newData ) | |||
31 | aTable[j].data = newData; | 31 | aTable[j].data = newData; |
32 | } | 32 | } |
33 | 33 | ||
34 | void HashTable::clear() | ||
35 | { | ||
36 | memset( aTable, 0, sizeof(HashNode) * nTableSize ); | ||
37 | } | ||
38 | |||
34 | bool HashTable::isFilled( int j ) | 39 | bool HashTable::isFilled( int j ) |
35 | { | 40 | { |
36 | return (aTable[j].id != NULL)||(aTable[j].bDeleted); | 41 | return (aTable[j].id != NULL)||(aTable[j].bDeleted); |
diff --git a/src/hashtable.h b/src/hashtable.h index d14be71..b015107 100644 --- a/src/hashtable.h +++ b/src/hashtable.h | |||
@@ -175,6 +175,13 @@ public: | |||
175 | */ | 175 | */ |
176 | bool del( const void *id, int nSkip=0 ); | 176 | bool del( const void *id, int nSkip=0 ); |
177 | 177 | ||
178 | /** | ||
179 | * Deletes every entry in the hash table. See the notes on del to see what | ||
180 | * this means, except that since no data is being kept, the entire table is | ||
181 | * just marked as usable space. | ||
182 | */ | ||
183 | void clear(); | ||
184 | |||
178 | private: | 185 | private: |
179 | /** | 186 | /** |
180 | * Contains info related to a position in the hashtable. Used for | 187 | * Contains info related to a position in the hashtable. Used for |