Home | History | Annotate | Line # | Download | only in common
calloc.c revision 1.1.92.1
      1  1.1.92.1     jym /*	$NetBSD: calloc.c,v 1.1.92.1 2009/05/13 17:17:57 jym 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.1.92.1     jym 		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