mirror of https://github.com/YosysHQ/abc.git
More compiler warnings.
This commit is contained in:
parent
91aaff2575
commit
8742534db8
|
|
@ -99,7 +99,7 @@ template<class T>
|
|||
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 || (((data = (T*)::realloc((void*)data, (cap += add) * sizeof(T))) == NULL) && errno == ENOMEM))
|
||||
throw OutOfMemoryException();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -101,14 +101,14 @@ template<class T>
|
|||
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 || (((data = (T*)::realloc((void*)data, (cap += add) * sizeof(T))) == NULL) && errno == ENOMEM))
|
||||
throw OutOfMemoryException();
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void vec<T>::prelocate(int ext_cap) {
|
||||
if (cap >= ext_cap) return;
|
||||
if (ext_cap > INT_MAX || (((data = (T*)::realloc(data, ext_cap * sizeof(T))) == NULL) && errno == ENOMEM))
|
||||
if (ext_cap > INT_MAX || (((data = (T*)::realloc((void*)data, ext_cap * sizeof(T))) == NULL) && errno == ENOMEM))
|
||||
throw OutOfMemoryException();
|
||||
cap = ext_cap;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue