[project @ 2000-05-11 13:15:38 by simonmar]
[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.3 1999/11/25 16:54:14 simonmar Exp $
5  *
6  * malloc interface
7  */
8
9 #include "Rts.h"
10 #include "stgio.h"
11
12 StgAddr
13 allocMemory__(StgInt sz/* bytes */)
14 {
15  StgAddr ptr;
16
17  if ( (ptr = malloc(sz*sizeof(char))) == NULL) {
18         ghc_errtype = ERR_RESOURCEEXHAUSTED;
19         ghc_errstr  = "malloc failed";
20         return NULL;
21  }
22  return ptr;
23
24 }