ports/devel/cbmc/files/patch-minisat-2.2.1_minisat_mtl_Vec.h
Olivier Cochard 7f087b720e devel/cbmc: add new port
Bounded Model Checker for C and C++ programs
https://github.com/diffblue/cbmc

Sponsored by:	Netflix
2024-02-01 18:53:55 +01:00

16 lines
611 B
C++

--- minisat-2.2.1/minisat/mtl/Vec.h.orig 2011-02-21 13:31:17 UTC
+++ minisat-2.2.1/minisat/mtl/Vec.h
@@ -96,9 +96,11 @@ void vec<T>::capacity(int min_cap) {
void vec<T>::capacity(int min_cap) {
if (cap >= min_cap) return;
int add = imax((min_cap - cap + 1) & ~1, ((cap >> 1) + 2) & ~1); // NOTE: grow by approximately 3/2
- if (add > INT_MAX - cap || ((data = (T*)::realloc(data, (cap += add) * sizeof(T))) == NULL) && errno == ENOMEM)
+ if (add > INT_MAX - cap)
throw OutOfMemoryException();
- }
+
+ data = (T*)xrealloc(data, (cap += add) * sizeof(T));
+}
template<class T>