diff --git a/proto.h b/proto.h index 1753f61..d54b0b1 100644 --- a/proto.h +++ b/proto.h @@ -408,8 +408,8 @@ int flist_ndx_pop(flist_ndx_list *lp); void *expand_item_list(item_list *lp, size_t item_size, const char *desc, int incr); int msleep(int t); -void *_new_array(unsigned long num, unsigned int size, int use_calloc); -void *_realloc_array(void *ptr, unsigned int size, size_t num); +void *_new_array(size_t num, size_t size, int use_calloc); +void *_realloc_array(void *ptr, size_t size, size_t num); const char *sum_as_hex(int csum_type, const char *sum, int flist_csum); NORETURN void out_of_memory(const char *str); NORETURN void overflow_exit(const char *str); diff --git a/util2.c b/util2.c index 2722ab3..21c3e27 100644 --- a/util2.c +++ b/util2.c @@ -59,19 +59,13 @@ int msleep(int t) return True; } -#define MALLOC_MAX 0x40000000 - -void *_new_array(unsigned long num, unsigned int size, int use_calloc) +void *_new_array(size_t num, size_t size, int use_calloc) { - if (num >= MALLOC_MAX/size) - return NULL; return use_calloc ? calloc(num, size) : malloc(num * size); } -void *_realloc_array(void *ptr, unsigned int size, size_t num) +void *_realloc_array(void *ptr, size_t size, size_t num) { - if (num >= MALLOC_MAX/size) - return NULL; if (!ptr) return malloc(size * num); return realloc(ptr, size * num);