set ValueIterator's fIndex to the next slot so OpenHashTable's Iterator properly gets it.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20974 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
cc70cbe297
commit
f6cfc5af19
@ -75,8 +75,7 @@ public:
|
||||
: fOriginalIndex(index), fOriginalValue(value)
|
||||
{
|
||||
Iterator::fTable = table;
|
||||
Iterator::fIndex = index;
|
||||
Iterator::fNext = value;
|
||||
Rewind();
|
||||
}
|
||||
|
||||
bool HasNext() const
|
||||
@ -91,7 +90,7 @@ public:
|
||||
|
||||
void Rewind()
|
||||
{
|
||||
Iterator::fIndex = fOriginalIndex;
|
||||
Iterator::fIndex = fOriginalIndex + 1;
|
||||
Iterator::fNext = fOriginalValue;
|
||||
}
|
||||
|
||||
|
@ -114,16 +114,8 @@ public:
|
||||
|
||||
void InsertUnchecked(ValueType *value)
|
||||
{
|
||||
if (CheckDuplicates) {
|
||||
for (size_t i = 0; i < fTableSize; i++) {
|
||||
ValueType *bucket = fTable[i];
|
||||
while (bucket) {
|
||||
if (bucket == value)
|
||||
panic("Hash Table: value already in table.");
|
||||
bucket = _Link(bucket)->fNext;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CheckDuplicates && _ExaustiveSearch(value))
|
||||
panic("Hash Table: value already in table.");
|
||||
|
||||
_Insert(fTable, fTableSize, value);
|
||||
fItemCount++;
|
||||
@ -164,16 +156,8 @@ public:
|
||||
if (slot == NULL)
|
||||
return false;
|
||||
|
||||
if (CheckDuplicates) {
|
||||
for (size_t i = 0; i < fTableSize; i++) {
|
||||
ValueType *bucket = fTable[i];
|
||||
while (bucket) {
|
||||
if (bucket == value)
|
||||
panic("Hash Table: duplicate detected.");
|
||||
bucket = _Link(bucket)->fNext;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CheckDuplicates && _ExaustiveSearch(value))
|
||||
panic("Hash Table: duplicate detected.");
|
||||
|
||||
fItemCount--;
|
||||
return true;
|
||||
@ -270,6 +254,20 @@ protected:
|
||||
return fDefinition.GetLink(bucket);
|
||||
}
|
||||
|
||||
bool _ExaustiveSearch(ValueType *value) const
|
||||
{
|
||||
for (size_t i = 0; i < fTableSize; i++) {
|
||||
ValueType *bucket = fTable[i];
|
||||
while (bucket) {
|
||||
if (bucket == value)
|
||||
return true;
|
||||
bucket = _Link(bucket)->fNext;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Definition fDefinition;
|
||||
size_t fTableSize, fItemCount;
|
||||
ValueType **fTable;
|
||||
|
@ -933,6 +933,8 @@ UdpEndpoint::StoreData(net_buffer *buffer)
|
||||
status_t
|
||||
UdpEndpoint::DeliverData(net_buffer *_buffer)
|
||||
{
|
||||
TRACE_EP("DeliverData(%p [%ld bytes])", _buffer, _buffer->size);
|
||||
|
||||
net_buffer *buffer = gBufferModule->clone(_buffer, false);
|
||||
if (buffer == NULL)
|
||||
return B_NO_MEMORY;
|
||||
|
Loading…
Reference in New Issue
Block a user