19 |
|
|
20 |
#include <config.h> |
#include <config.h> |
21 |
#include "alloc.h" |
#include "alloc.h" |
|
#include <stdio.h> |
|
22 |
#include <stdlib.h> |
#include <stdlib.h> |
|
#include "error.h" |
|
|
#include "str.h" |
|
23 |
|
|
24 |
/* Report an out-of-memory condition and abort execution. */ |
/* Allocates and returns N elements of S bytes each. |
25 |
void |
N must be nonnegative, S must be positive. |
26 |
out_of_memory (void) |
Returns a null pointer if the memory cannot be obtained, |
27 |
|
including the case where N * S overflows the range of size_t. */ |
28 |
|
void * |
29 |
|
nmalloc (size_t n, size_t s) |
30 |
{ |
{ |
31 |
xalloc_die (); |
return !xalloc_oversized (n, s) ? malloc (n * s) : NULL; |
32 |
} |
} |