X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Falloc.c;h=a7b20283f38588f7fd7f955f692c0d624e4eff29;hb=16aa47dbdde420fe82032f7d2e166fdf4e974df5;hp=015d3397c19f28bd511bfe51307ff25a366ebfc3;hpb=4de79b34b329d1da6cdeb145993d3efd911e2967;p=pspp diff --git a/src/alloc.c b/src/alloc.c index 015d3397c1..a7b20283f3 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -19,14 +19,14 @@ #include #include "alloc.h" -#include #include -#include "error.h" -#include "str.h" -/* Report an out-of-memory condition and abort execution. */ -void -out_of_memory (void) +/* Allocates and returns N elements of S bytes each. + N must be nonnegative, S must be positive. + Returns a null pointer if the memory cannot be obtained, + including the case where N * S overflows the range of size_t. */ +void * +nmalloc (size_t n, size_t s) { - xalloc_die (); + return !xalloc_oversized (n, s) ? malloc (n * s) : NULL; }