9base

revived minimalist port of Plan 9 userland to Unix
git clone git://git.suckless.org/9base
Log | Files | Refs | README | LICENSE

mallocz.c (189B)


      1 #include <u.h>
      2 #include <unistd.h>
      3 #include <string.h>
      4 #include <libc.h>
      5 
      6 void*
      7 mallocz(unsigned long n, int clr)
      8 {
      9 	void *v;
     10 
     11 	v = malloc(n);
     12 	if(clr && v)
     13 		memset(v, 0, n);
     14 	return v;
     15 }