|
|
1.1 root 1: /*
2: * C general utilities library.
3: * calloc()
4: * ANSI 4.10.3.1.
5: * Allocate and clear.
6: */
7:
8: #include <stdlib.h>
9: #include <string.h>
10:
11: /*
12: * This does not check that size*nmemb fits in a size_t.
13: * The return type should be void *.
14: */
15: char *
16: calloc(nmemb, size) size_t nmemb; register size_t size;
17: {
18: register char *bp; /* should be void * */
19:
20: size *= nmemb;
21: if ((bp = malloc(size)) != NULL)
22: memset(bp, 0, size);
23: return bp;
24: }
25:
26: /* end of calloc.c */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.