mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 14:03:07 +01:00
Style and simplification
This commit is contained in:
parent
18b6781b8d
commit
a5ceabacc8
@ -85,11 +85,11 @@ public:
|
||||
void clear() { count = 0; };
|
||||
protected:
|
||||
const T& getElement(size_t index) const {
|
||||
fb_assert(index >= 0 && index < count);
|
||||
fb_assert(index < count);
|
||||
return data[index];
|
||||
}
|
||||
T& getElement(size_t index) {
|
||||
fb_assert(index >= 0 && index < count);
|
||||
fb_assert(index < count);
|
||||
return data[index];
|
||||
}
|
||||
void freeData()
|
||||
@ -132,13 +132,13 @@ public:
|
||||
T* begin() { return data; }
|
||||
T* end() { return data + count; }
|
||||
void insert(size_t index, const T& item) {
|
||||
fb_assert(index >= 0 && index <= count);
|
||||
fb_assert(index <= count);
|
||||
ensureCapacity(count + 1);
|
||||
memmove(data + index + 1, data + index, sizeof(T) * (count++ - index));
|
||||
data[index] = item;
|
||||
}
|
||||
void insert(size_t index, const Array<T, Storage>& L) {
|
||||
fb_assert(index >= 0 && index <= count);
|
||||
fb_assert(index <= count);
|
||||
ensureCapacity(count + L.count);
|
||||
memmove(data + index + L.count, data + index, sizeof(T) * (count - index));
|
||||
memcpy(data + index, L.data, L.count);
|
||||
@ -150,12 +150,12 @@ public:
|
||||
return count;
|
||||
};
|
||||
void remove(size_t index) {
|
||||
fb_assert(index >= 0 && index < count);
|
||||
fb_assert(index < count);
|
||||
memmove(data + index, data + index + 1, sizeof(T) * (--count - index));
|
||||
}
|
||||
void remove(T* itr) {
|
||||
size_t index = itr - begin();
|
||||
fb_assert(index >= 0 && index < count);
|
||||
const size_t index = itr - begin();
|
||||
fb_assert(index < count);
|
||||
memmove(data + index, data + index + 1, sizeof(T) * (--count - index));
|
||||
}
|
||||
void shrink(size_t newCount) {
|
||||
@ -236,7 +236,7 @@ public:
|
||||
bool find(const Key& item, size_t& pos) const {
|
||||
size_t highBound = this->count, lowBound = 0;
|
||||
while (highBound > lowBound) {
|
||||
size_t temp = (highBound + lowBound) >> 1;
|
||||
const size_t temp = (highBound + lowBound) >> 1;
|
||||
if (Cmp::greaterThan(item, KeyOfValue::generate(this, this->data[temp])))
|
||||
lowBound = temp + 1;
|
||||
else
|
||||
|
@ -24,7 +24,7 @@
|
||||
* Contributor(s): ______________________________________.
|
||||
*
|
||||
*
|
||||
* $Id: tree.h,v 1.37 2004-07-17 00:13:07 skidder Exp $
|
||||
* $Id: tree.h,v 1.38 2004-07-22 07:17:58 robocop Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -321,7 +321,7 @@ public:
|
||||
}
|
||||
|
||||
curr = (ItemList *)list;
|
||||
bool found = curr->find(key, curPos);
|
||||
const bool found = curr->find(key, curPos);
|
||||
switch (lt) {
|
||||
case locEqual: return found;
|
||||
case locGreatEqual:
|
||||
@ -400,7 +400,8 @@ public:
|
||||
curPos = 0;
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
}
|
||||
else
|
||||
curPos--;
|
||||
return true;
|
||||
}
|
||||
@ -686,7 +687,7 @@ void BePlusTree<Value, Key, Allocator, KeyOfValue, Cmp, LeafCount, NodeCount>::_
|
||||
#ifndef DEV_BUILD
|
||||
list->find(NodeList::generate(list, node), pos);
|
||||
#else
|
||||
bool found = list->find(NodeList::generate(list, node), pos);
|
||||
const bool found = list->find(NodeList::generate(list, node), pos);
|
||||
fb_assert(found);
|
||||
#endif
|
||||
list->remove(pos);
|
||||
|
@ -24,7 +24,7 @@
|
||||
* Contributor(s): ______________________________________.
|
||||
*
|
||||
*
|
||||
* $Id: vector.h,v 1.11 2004-07-16 23:06:04 skidder Exp $
|
||||
* $Id: vector.h,v 1.12 2004-07-22 07:17:58 robocop Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -43,13 +43,13 @@ public:
|
||||
Vector() : count(0) {}
|
||||
void clear() { count = 0; };
|
||||
T& operator[](size_t index) {
|
||||
fb_assert(index >= 0 && index < count);
|
||||
fb_assert(index < count);
|
||||
return data[index];
|
||||
}
|
||||
T* begin() { return data; }
|
||||
T* end() { return data + count; }
|
||||
void insert(size_t index, const T& item) {
|
||||
fb_assert(index >= 0 && index <= count);
|
||||
fb_assert(index <= count);
|
||||
fb_assert(count < Capacity);
|
||||
memmove(data + index + 1, data + index, sizeof(T) * (count++ - index));
|
||||
data[index] = item;
|
||||
@ -61,7 +61,7 @@ public:
|
||||
return count;
|
||||
};
|
||||
void remove(size_t index) {
|
||||
fb_assert(index >= 0 && index < count);
|
||||
fb_assert(index < count);
|
||||
memmove(data + index, data + index + 1, sizeof(T) * (--count - index));
|
||||
}
|
||||
void shrink(size_t newCount) {
|
||||
|
Loading…
Reference in New Issue
Block a user