2002-09-17 23:03:30 +00:00
|
|
|
char rcsid_zalloc[] = "$Id$";
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include "b.h"
|
|
|
|
|
|
|
|
extern void exit ARGS((int));
|
|
|
|
extern void free ARGS((void *));
|
|
|
|
extern void *malloc ARGS((unsigned));
|
|
|
|
|
|
|
|
int
|
2002-09-22 02:40:40 +00:00
|
|
|
fatal(const char *name, int line)
|
2002-09-17 23:03:30 +00:00
|
|
|
{
|
|
|
|
fprintf(stderr, "assertion failed: file %s, line %d\n", name, line);
|
|
|
|
exit(1);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void *
|
|
|
|
zalloc(size) unsigned int size;
|
|
|
|
{
|
|
|
|
void *t = (void *) malloc(size);
|
|
|
|
if (!t) {
|
|
|
|
fprintf(stderr, "Malloc failed---PROGRAM ABORTED\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
memset(t, 0, size);
|
|
|
|
return t;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
zfree(p) void *p;
|
|
|
|
{
|
|
|
|
free(p);
|
|
|
|
}
|