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