mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-20 04:35:58 +00:00
Add simple in-line implementation of rdcarray::push_back
* Coverity can't figure out that a pointer being push_back'd isn't leaking, possibly due to the call to insert.
This commit is contained in:
@@ -158,7 +158,6 @@ public:
|
||||
bool empty() const { return usedCount == 0; }
|
||||
bool isEmpty() const { return usedCount == 0; }
|
||||
void clear() { resize(0); }
|
||||
void push_back(const T &el) { insert(size(), &el, 1); }
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// managing elements and memory
|
||||
|
||||
@@ -231,6 +230,15 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void push_back(const T &el)
|
||||
{
|
||||
// in-line implementation here instead of insert()
|
||||
const size_t lastIdx = size();
|
||||
reserve(size() + 1);
|
||||
new(elems + lastIdx) T(el);
|
||||
setUsedCount(usedCount + 1);
|
||||
}
|
||||
|
||||
void insert(size_t offs, const T *el, size_t count)
|
||||
{
|
||||
const size_t oldSize = size();
|
||||
|
||||
Reference in New Issue
Block a user