2016-11-24 19:35:26 +00:00
|
|
|
#include <stdlib.h>
|
2010-10-02 21:52:29 +00:00
|
|
|
#include <em_abs.h>
|
|
|
|
#include <pc_err.h>
|
1984-07-20 10:44:57 +00:00
|
|
|
|
2010-10-02 21:52:29 +00:00
|
|
|
extern void _trp(int); /* called on error */
|
|
|
|
|
2016-11-24 19:35:26 +00:00
|
|
|
void _new(int n, void** ptr)
|
2010-10-02 21:52:29 +00:00
|
|
|
{
|
2016-11-24 19:35:26 +00:00
|
|
|
void* p = malloc(n);
|
|
|
|
if (!p)
|
|
|
|
_trp(EHEAP);
|
2010-10-02 21:52:29 +00:00
|
|
|
|
2016-11-24 19:35:26 +00:00
|
|
|
*ptr = p;
|
|
|
|
}
|
2010-10-02 21:52:29 +00:00
|
|
|
|
2016-11-24 19:35:26 +00:00
|
|
|
void _dis(int n, void** ptr)
|
2010-10-02 21:52:29 +00:00
|
|
|
{
|
2016-11-24 19:35:26 +00:00
|
|
|
free(*ptr);
|
|
|
|
*ptr = NULL;
|
|
|
|
}
|