8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 19:23:03 +01:00

First add an element, next increase count - makes class safer in MT world

This commit is contained in:
alexpeshkoff 2008-01-31 11:03:55 +00:00
parent 5ce35395c7
commit e231c73051
2 changed files with 4 additions and 4 deletions

View File

@ -156,8 +156,8 @@ public:
}
size_t add(const T& item) {
ensureCapacity(count + 1);
data[count++] = item;
return count;
data[count] = item;
return ++count;
}
// NOTE: remove method must be signal safe
// This function may be called in AST. The function doesn't wait.

View File

@ -65,8 +65,8 @@ public:
}
size_t add(const T& item) {
fb_assert(count < Capacity);
data[count++] = item;
return count;
data[count] = item;
return ++count;
}
T* remove(size_t index) {
fb_assert(index < count);