aboutsummaryrefslogtreecommitdiff
path: root/src/lib9/malloc.c
blob: a32178b3bc2d8f60bd7843061c433fee9293d6c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
 * These are here mainly so that I can link against
 * debugmalloc.c instead and not recompile the world.
 */

#include <u.h>
#define NOPLAN9DEFINES
#include <libc.h>

void*
p9malloc(ulong n)
{
	if(n == 0)
		n++;
	return malloc(n);
}

void
p9free(void *v)
{
	if(v == nil)
		return;
	free(v);
}

void*
p9calloc(ulong a, ulong b)
{
	if(a*b == 0)
		a = b = 1;

	return calloc(a*b, 1);
}

void*
p9realloc(void *v, ulong n)
{
	return realloc(v, n);
}