File: xmalloc.c

package info (click to toggle)
zile 1.0a5-3
  • links: PTS
  • area: main
  • in suites: slink
  • size: 744 kB
  • ctags: 578
  • sloc: ansic: 6,090; makefile: 278; sh: 107
file content (21 lines) | stat: -rw-r--r-- 252 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
#include "config.h"

#include <assert.h>
#include <err.h>
#include <stdlib.h>

/*
 * Return an allocated memory area.
 */
void *
xmalloc(size_t size)
{
	void *ptr;

	assert(size > 0);

	if ((ptr = malloc(size)) == NULL)
		err(1, NULL);

	return ptr;
}