1984-10-08 14:14:53 +00:00
|
|
|
/*
|
|
|
|
* (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
|
|
|
*
|
|
|
|
* This product is part of the Amsterdam Compiler Kit.
|
|
|
|
*
|
|
|
|
* Permission to use, sell, duplicate or disclose this software must be
|
|
|
|
* obtained in writing. Requests for such permissions may be sent to
|
|
|
|
*
|
|
|
|
* Dr. Andrew S. Tanenbaum
|
|
|
|
* Wiskundig Seminarium
|
|
|
|
* Vrije Universiteit
|
|
|
|
* Postbox 7161
|
|
|
|
* 1007 MC Amsterdam
|
|
|
|
* The Netherlands
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* L L G E N
|
|
|
|
*
|
|
|
|
* An Extended LL(1) Parser Generator
|
|
|
|
*
|
|
|
|
* Author : Ceriel J.H. Jacobs
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* alloc.c
|
|
|
|
* Interface to malloc() and realloc()
|
|
|
|
*/
|
|
|
|
|
|
|
|
# include "types.h"
|
|
|
|
# include "extern.h"
|
|
|
|
|
1984-10-08 17:11:03 +00:00
|
|
|
# ifndef NORCSID
|
|
|
|
static string rcsida = "$Header$";
|
|
|
|
# endif
|
1984-10-08 14:14:53 +00:00
|
|
|
|
|
|
|
static string e_nomem = "Out of memory";
|
|
|
|
|
|
|
|
p_mem
|
|
|
|
alloc(size) unsigned size; {
|
|
|
|
register p_mem p;
|
|
|
|
p_mem malloc();
|
|
|
|
|
|
|
|
if ((p = malloc(size)) == 0) fatal(linecount,e_nomem);
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
|
|
|
p_mem
|
|
|
|
ralloc(p,size) p_mem p; unsigned size; {
|
|
|
|
register p_mem q;
|
|
|
|
p_mem realloc();
|
|
|
|
|
|
|
|
if ((q = realloc(p,size)) == 0) fatal(linecount,e_nomem);
|
|
|
|
return q;
|
|
|
|
}
|