File: util.c

package info (click to toggle)
xbill 2.1-10
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 808 kB
  • sloc: ansic: 3,252; sh: 197; makefile: 101
file content (22 lines) | stat: -rw-r--r-- 330 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>

void
fatal(const char *format, ...) {
	va_list args;

	va_start(args, format);
	vfprintf(stderr, format, args);
	va_end(args);
	fprintf(stderr, "\n");
	exit(1);
}

void *
xalloc(int size) {
	void *p = malloc(size);
	if (p == NULL)
		fatal("out of memory");
	return p;
}