Home | History | Annotate | Line # | Download | only in common
      1  1.2  cegger /*	$NetBSD: calloc.c,v 1.2 2009/03/18 16:00:12 cegger Exp $	*/
      2  1.1  cherry 
      3  1.1  cherry #include <sys/cdefs.h>
      4  1.1  cherry #include <sys/types.h>
      5  1.1  cherry 
      6  1.1  cherry #include <lib/libsa/stand.h>
      7  1.1  cherry 
      8  1.1  cherry void *
      9  1.1  cherry calloc(u_int size1, u_int size2)
     10  1.1  cherry {
     11  1.1  cherry 	u_int total_size = size1 * size2;
     12  1.1  cherry 	void *ptr;
     13  1.1  cherry 
     14  1.1  cherry 	if(( (ptr = alloc(total_size)) != NULL)) {
     15  1.2  cegger 		memset(ptr, 0, total_size);
     16  1.1  cherry 	}
     17  1.1  cherry 
     18  1.1  cherry 	/* alloc will crib for me. */
     19  1.1  cherry 
     20  1.1  cherry 	return(ptr);
     21  1.1  cherry }
     22