From 9445c73970cd087b03ba3887f37a462d32c02e63 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Thu, 21 Aug 2008 23:17:27 +0000 Subject: [PATCH] * Fixed spelling typo. * Switched from new[]/delete[] to malloc()/free(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27119 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/kernel/util/OpenHashTable.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/headers/private/kernel/util/OpenHashTable.h b/headers/private/kernel/util/OpenHashTable.h index 9f9f657250..da4c87be8d 100644 --- a/headers/private/kernel/util/OpenHashTable.h +++ b/headers/private/kernel/util/OpenHashTable.h @@ -49,7 +49,7 @@ public: static const size_t kMinimumSize = 8; - // we use new [] / delete [] for allocation. If in the future this + // we use malloc() / free() for allocation. If in the future this // is revealed to be insufficient we can switch to a template based // allocator. All allocations are of power of 2 lengths. @@ -75,7 +75,7 @@ public: ~OpenHashTable() { - delete [] fTable; + free(fTable); } status_t Init(size_t initialSize = kMinimumSize) @@ -116,7 +116,7 @@ public: void InsertUnchecked(ValueType *value) { - if (CheckDuplicates && _ExaustiveSearch(value)) + if (CheckDuplicates && _ExhaustiveSearch(value)) panic("Hash Table: value already in table."); _Insert(fTable, fTableSize, value); @@ -160,7 +160,7 @@ public: if (slot == NULL) return false; - if (CheckDuplicates && _ExaustiveSearch(value)) + if (CheckDuplicates && _ExhaustiveSearch(value)) panic("Hash Table: duplicate detected."); fItemCount--; @@ -228,7 +228,8 @@ protected: bool _Resize(size_t newSize) { - ValueType **newTable = new ValueType *[newSize]; + ValueType **newTable + = (ValueType**)malloc(sizeof(ValueType*) * newSize); if (newTable == NULL) return false; @@ -245,7 +246,7 @@ protected: } } - delete [] fTable; + free(fTable); } fTableSize = newSize; @@ -258,7 +259,7 @@ protected: return fDefinition.GetLink(bucket); } - bool _ExaustiveSearch(ValueType *value) const + bool _ExhaustiveSearch(ValueType *value) const { for (size_t i = 0; i < fTableSize; i++) { ValueType *bucket = fTable[i];