mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 22:43:04 +01:00
First add an element, next increase count - makes class safer in MT world
This commit is contained in:
parent
5ce35395c7
commit
e231c73051
@ -156,8 +156,8 @@ public:
|
|||||||
}
|
}
|
||||||
size_t add(const T& item) {
|
size_t add(const T& item) {
|
||||||
ensureCapacity(count + 1);
|
ensureCapacity(count + 1);
|
||||||
data[count++] = item;
|
data[count] = item;
|
||||||
return count;
|
return ++count;
|
||||||
}
|
}
|
||||||
// NOTE: remove method must be signal safe
|
// NOTE: remove method must be signal safe
|
||||||
// This function may be called in AST. The function doesn't wait.
|
// This function may be called in AST. The function doesn't wait.
|
||||||
|
@ -65,8 +65,8 @@ public:
|
|||||||
}
|
}
|
||||||
size_t add(const T& item) {
|
size_t add(const T& item) {
|
||||||
fb_assert(count < Capacity);
|
fb_assert(count < Capacity);
|
||||||
data[count++] = item;
|
data[count] = item;
|
||||||
return count;
|
return ++count;
|
||||||
}
|
}
|
||||||
T* remove(size_t index) {
|
T* remove(size_t index) {
|
||||||
fb_assert(index < count);
|
fb_assert(index < count);
|
||||||
|
Loading…
Reference in New Issue
Block a user