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