added automake.mk files in src/language
[pspp] / src / alloc.c
index 015d3397c19f28bd511bfe51307ff25a366ebfc3..a7b20283f38588f7fd7f955f692c0d624e4eff29 100644 (file)
 
 #include <config.h>
 #include "alloc.h"
-#include <stdio.h>
 #include <stdlib.h>
-#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;
 }