mirror of https://github.com/YosysHQ/yosys.git
minisat: Use reallocarray
Avoid gcc warning about non-trivial copying.
This commit is contained in:
parent
d34833d177
commit
eb02ab07da
|
@ -100,7 +100,7 @@ void vec<T,_Size>::capacity(Size min_cap) {
|
||||||
Size add = max((min_cap - cap + 1) & ~1, ((cap >> 1) + 2) & ~1); // NOTE: grow by approximately 3/2
|
Size add = max((min_cap - cap + 1) & ~1, ((cap >> 1) + 2) & ~1); // NOTE: grow by approximately 3/2
|
||||||
const Size size_max = std::numeric_limits<Size>::max();
|
const Size size_max = std::numeric_limits<Size>::max();
|
||||||
if ( ((size_max <= std::numeric_limits<int>::max()) && (add > size_max - cap))
|
if ( ((size_max <= std::numeric_limits<int>::max()) && (add > size_max - cap))
|
||||||
|| (((data = (T*)::realloc(data, (cap += add) * sizeof(T))) == NULL) && errno == ENOMEM) )
|
|| (((data = (T*)::reallocarray(data, (cap += add), sizeof(T))) == NULL) && errno == ENOMEM) )
|
||||||
throw OutOfMemoryException();
|
throw OutOfMemoryException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue