plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

malloc.c (423B)


      1 /*
      2  * These are here mainly so that I can link against
      3  * debugmalloc.c instead and not recompile the world.
      4  */
      5 
      6 #include <u.h>
      7 #define NOPLAN9DEFINES
      8 #include <libc.h>
      9 
     10 
     11 void*
     12 p9malloc(ulong n)
     13 {
     14 	if(n == 0)
     15 		n++;
     16 	return malloc(n);
     17 }
     18 
     19 void
     20 p9free(void *v)
     21 {
     22 	free(v);
     23 }
     24 
     25 void*
     26 p9calloc(ulong a, ulong b)
     27 {
     28 	if(a*b == 0)
     29 		a = b = 1;
     30 	return calloc(a, b);
     31 }
     32 
     33 void*
     34 p9realloc(void *v, ulong n)
     35 {
     36 	return realloc(v, n);
     37 }