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