diff --git a/src/common/classes/array.h b/src/common/classes/array.h index 2501abe865..64acc77d0f 100644 --- a/src/common/classes/array.h +++ b/src/common/classes/array.h @@ -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. diff --git a/src/common/classes/vector.h b/src/common/classes/vector.h index 89746f5d3c..6ebf1f1701 100644 --- a/src/common/classes/vector.h +++ b/src/common/classes/vector.h @@ -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);