| 144 | } |
| 145 | |
| 146 | void *xcalloc(size_t nmemb, size_t size) |
| 147 | { |
| 148 | void *ret; |
| 149 | |
| 150 | if (unsigned_mult_overflows(nmemb, size)) |
| 151 | die("data too large to fit into virtual memory space"); |
| 152 | |
| 153 | memory_limit_check(size * nmemb, 0); |
| 154 | ret = calloc(nmemb, size); |
| 155 | if (!ret && (!nmemb || !size)) |
| 156 | ret = calloc(1, 1); |
| 157 | if (!ret) |
| 158 | die("Out of memory, calloc failed"); |
| 159 | return ret; |
| 160 | } |
| 161 | |
| 162 | void xsetenv(const char *name, const char *value, int overwrite) |
| 163 | { |