1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00
llvm-mirror/support/tools/Burg/zalloc.c
Chris Lattner 48fc42ba79 Fix tons of warnings, convert burg to use Makefile.common system, rename
gram.y to gram.yc so that we don't try to turn it into a .cpp file.

llvm-svn: 3874
2002-09-22 02:40:40 +00:00

36 lines
550 B
C

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
fatal(const char *name, int line)
{
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);
}