* 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
This commit is contained in:
@@ -49,7 +49,7 @@ public:
|
|||||||
|
|
||||||
static const size_t kMinimumSize = 8;
|
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
|
// is revealed to be insufficient we can switch to a template based
|
||||||
// allocator. All allocations are of power of 2 lengths.
|
// allocator. All allocations are of power of 2 lengths.
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ public:
|
|||||||
|
|
||||||
~OpenHashTable()
|
~OpenHashTable()
|
||||||
{
|
{
|
||||||
delete [] fTable;
|
free(fTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t Init(size_t initialSize = kMinimumSize)
|
status_t Init(size_t initialSize = kMinimumSize)
|
||||||
@@ -116,7 +116,7 @@ public:
|
|||||||
|
|
||||||
void InsertUnchecked(ValueType *value)
|
void InsertUnchecked(ValueType *value)
|
||||||
{
|
{
|
||||||
if (CheckDuplicates && _ExaustiveSearch(value))
|
if (CheckDuplicates && _ExhaustiveSearch(value))
|
||||||
panic("Hash Table: value already in table.");
|
panic("Hash Table: value already in table.");
|
||||||
|
|
||||||
_Insert(fTable, fTableSize, value);
|
_Insert(fTable, fTableSize, value);
|
||||||
@@ -160,7 +160,7 @@ public:
|
|||||||
if (slot == NULL)
|
if (slot == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (CheckDuplicates && _ExaustiveSearch(value))
|
if (CheckDuplicates && _ExhaustiveSearch(value))
|
||||||
panic("Hash Table: duplicate detected.");
|
panic("Hash Table: duplicate detected.");
|
||||||
|
|
||||||
fItemCount--;
|
fItemCount--;
|
||||||
@@ -228,7 +228,8 @@ protected:
|
|||||||
|
|
||||||
bool _Resize(size_t newSize)
|
bool _Resize(size_t newSize)
|
||||||
{
|
{
|
||||||
ValueType **newTable = new ValueType *[newSize];
|
ValueType **newTable
|
||||||
|
= (ValueType**)malloc(sizeof(ValueType*) * newSize);
|
||||||
if (newTable == NULL)
|
if (newTable == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -245,7 +246,7 @@ protected:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete [] fTable;
|
free(fTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
fTableSize = newSize;
|
fTableSize = newSize;
|
||||||
@@ -258,7 +259,7 @@ protected:
|
|||||||
return fDefinition.GetLink(bucket);
|
return fDefinition.GetLink(bucket);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _ExaustiveSearch(ValueType *value) const
|
bool _ExhaustiveSearch(ValueType *value) const
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < fTableSize; i++) {
|
for (size_t i = 0; i < fTableSize; i++) {
|
||||||
ValueType *bucket = fTable[i];
|
ValueType *bucket = fTable[i];
|
||||||
|
|||||||
Reference in New Issue
Block a user