plan9port/src/lib9/malloc.c

40 lines
449 B
C
Raw Normal View History

2004-05-23 00:58:23 +00:00
/*
2004-06-09 14:22:08 +00:00
* These are here mainly so that I can link against
* debugmalloc.c instead and not recompile the world.
2004-05-23 00:58:23 +00:00
*/
2004-06-09 14:22:08 +00:00
#include <u.h>
#define NOPLAN9DEFINES
#include <libc.h>
2004-05-23 00:58:23 +00:00
void*
p9malloc(ulong n)
{
if(n == 0)
n++;
2004-06-09 14:22:08 +00:00
return malloc(n);
2004-05-23 00:58:23 +00:00
}
void
p9free(void *v)
{
2004-06-09 14:22:08 +00:00
if(v == nil)
return;
2004-05-23 00:58:23 +00:00
free(v);
}
void*
p9calloc(ulong a, ulong b)
{
2004-06-09 14:22:08 +00:00
if(a*b == 0)
a = b = 1;
2004-05-23 00:58:23 +00:00
2004-06-09 14:22:08 +00:00
return calloc(a*b, 1);
2004-05-23 00:58:23 +00:00
}
void*
p9realloc(void *v, ulong n)
{
2004-06-09 14:22:08 +00:00
return realloc(v, n);
}