Remove references in index iterator interface
This avoids checks.
This commit is contained in:
parent
1197afa806
commit
e8d560154a
@ -49,32 +49,23 @@ Index::Init(Volume* volume, const char* name, uint32 type, bool fixedKeyLength,
|
||||
|
||||
|
||||
bool
|
||||
Index::GetIterator(IndexIterator* iterator)
|
||||
Index::GetIterator(IndexIterator& iterator)
|
||||
{
|
||||
bool result = false;
|
||||
if (iterator) {
|
||||
AbstractIndexIterator* actualIterator = InternalGetIterator();
|
||||
if (actualIterator) {
|
||||
iterator->SetIterator(actualIterator);
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
AbstractIndexIterator* actualIterator = InternalGetIterator();
|
||||
iterator.SetIterator(actualIterator);
|
||||
|
||||
return actualIterator != NULL;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
Index::Find(const void* key, size_t length, IndexIterator* iterator)
|
||||
Index::Find(const void* key, size_t length, IndexIterator& iterator)
|
||||
{
|
||||
bool result = false;
|
||||
if (key && iterator) {
|
||||
AbstractIndexIterator* actualIterator = InternalFind(key, length);
|
||||
if (actualIterator) {
|
||||
iterator->SetIterator(actualIterator);
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
AbstractIndexIterator* actualIterator
|
||||
= key != NULL ? InternalFind(key, length) : NULL;
|
||||
iterator.SetIterator(actualIterator);
|
||||
|
||||
return actualIterator != NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,9 +42,9 @@ public:
|
||||
|
||||
virtual int32 CountEntries() const = 0;
|
||||
|
||||
bool GetIterator(IndexIterator* iterator);
|
||||
bool GetIterator(IndexIterator& iterator);
|
||||
bool Find(const void* key, size_t length,
|
||||
IndexIterator* iterator);
|
||||
IndexIterator& iterator);
|
||||
// sets the iterator to the first value
|
||||
// >= key
|
||||
|
||||
|
@ -119,7 +119,7 @@ struct Query::QueryPolicy {
|
||||
if (iterator == NULL)
|
||||
return NULL;
|
||||
|
||||
if (!index.index->GetIterator(iterator)) {
|
||||
if (!index.index->GetIterator(*iterator)) {
|
||||
delete iterator;
|
||||
return NULL;
|
||||
}
|
||||
@ -137,7 +137,7 @@ struct Query::QueryPolicy {
|
||||
static status_t IndexIteratorFind(IndexIterator* indexIterator,
|
||||
const void* value, size_t size)
|
||||
{
|
||||
if (!indexIterator->index->Find(value, size, indexIterator))
|
||||
if (!indexIterator->index->Find(value, size, *indexIterator))
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
|
||||
return B_OK;
|
||||
|
Loading…
Reference in New Issue
Block a user