`size_t' makes this safeguard unnecessary.

This commit is contained in:
Nicolás A. Ortega 2016-12-14 23:42:20 +01:00
parent 4390fca3ef
commit 803c6f9e06
No known key found for this signature in database
GPG Key ID: 614272579C2070D1

View File

@ -27,10 +27,6 @@ void deInitList(List *restrict l) {
void addToList(List *l, mpz_t n) { void addToList(List *l, mpz_t n) {
if(l->end == l->size) { if(l->end == l->size) {
l->size += BLOCK_SIZE; l->size += BLOCK_SIZE;
if(l->size == 0) {
fprintf(stderr, "`l->size' has overflowed!\n");
exit(1);
}
void *tmp = realloc(l->list, sizeof(mpz_t) * l->size); void *tmp = realloc(l->list, sizeof(mpz_t) * l->size);
if(!tmp) { if(!tmp) {
fprintf(stderr, "Failed to allocate more memory to list!\n"); fprintf(stderr, "Failed to allocate more memory to list!\n");