ack/lang/pc/libpc/new.c
David Given c084f9f224 Remove the Mark() and Release() procedures from the Pascal compiler and
standard library, because they never worked and come from an achingly old
version of the Pascal specification. Fix the implementations of New() and
Dispose() to use the standard C memory allocator rather than rolling their own
(also in C). Write test!
2016-11-24 20:35:26 +01:00

20 lines
260 B
C

#include <stdlib.h>
#include <em_abs.h>
#include <pc_err.h>
extern void _trp(int); /* called on error */
void _new(int n, void** ptr)
{
void* p = malloc(n);
if (!p)
_trp(EHEAP);
*ptr = p;
}
void _dis(int n, void** ptr)
{
free(*ptr);
*ptr = NULL;
}