From 55307a5452d2138d58b7f56a415a27733e8ca6be Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Fri, 16 Aug 2024 04:30:37 +1200 Subject: [PATCH] minisat: Check for gcc --- libs/minisat/Vec.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libs/minisat/Vec.h b/libs/minisat/Vec.h index 9e6d21174..c5c913be9 100644 --- a/libs/minisat/Vec.h +++ b/libs/minisat/Vec.h @@ -100,7 +100,13 @@ void vec::capacity(Size min_cap) { 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::max(); if ( ((size_max <= std::numeric_limits::max()) && (add > size_max - cap)) - || (((data = (T*)::reallocarray(data, (cap += add), sizeof(T))) == NULL) && errno == ENOMEM) ) + || ( +#ifdef _DEFAULT_SOURCE + ((data = (T*)::reallocarray(data, (cap += add), sizeof(T))) == NULL) +#else + ((data = (T*)::realloc(data, (cap += add) * sizeof(T))) == NULL) +#endif + && errno == ENOMEM) ) throw OutOfMemoryException(); }