[project @ 1998-12-02 13:17:09 by simonm]
[ghc-hetmet.git] / ghc / lib / std / cbits / allocMem.c
1 /* 
2  * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
3  *
4  * $Id: allocMem.c,v 1.2 1998/12/02 13:27:13 simonm Exp $
5  *
6  * malloc interface
7  */
8
9 #include "Rts.h"
10 #include "stgio.h"
11
12 StgAddr
13 allocMemory__(sz)
14 StgInt sz;/* bytes*/
15 {
16  StgAddr ptr;
17
18  if ( (ptr = malloc(sz*sizeof(char))) == NULL) {
19         ghc_errtype = ERR_RESOURCEEXHAUSTED;
20         ghc_errstr  = "malloc failed";
21         return NULL;
22  }
23  return ptr;
24
25 }