1: /* @(#)calloc.c 2.1 SCCS id keyword */
2: /* calloc - allocate and clear memory block
3: */
4: #define CHARPERINT (sizeof(int)/sizeof(char))
5: #define NULL 0
6:
7: char *
8: calloc(num, size)
9: unsigned num, size;
10: {
11: register char *mp;
12: char *malloc();
13: register int *q;
14: register m;
15:
16: num *= size;
17: mp = malloc(num);
18: if(mp == NULL)
19: return(NULL);
20: q = (int *) mp;
21: m = (num+CHARPERINT-1)/CHARPERINT;
22: while(--m>=0)
23: *q++ = 0;
24: return(mp);
25: }
26:
27: /*ARGSUSED*/
28: cfree(p, num, size)
29: char *p;
30: unsigned num, size;
31: {
32: free(p);
33: }
Defined functions
calloc
defined in line
7; used 107 times
- in /usr/src/cmd/cu.3451A.c line
970,
980
- in /usr/src/cmd/cu.c line
833,
843
- in /usr/src/cmd/deroff.c line
51,
183,
488
- in /usr/src/cmd/f77/driver.c line
921-923(2)
- in /usr/src/cmd/f77/misc.c line
598-600(2)
- in /usr/src/cmd/lex/ldefs.c line
161
- in /usr/src/cmd/lex/lmain.c line
192
- in /usr/src/cmd/ls/symlnk_ucbls.c line
448-450(2)
- in /usr/src/cmd/ls/ucbls.c line
439-441(2)
- in /usr/src/cmd/make/misc.c line
85-88(2),
142
- in /usr/src/cmd/man.c line
320,
414
- in /usr/src/cmd/newgrp.c line
91
- in /usr/src/cmd/ps/ps.c line
86,
723,
800
- in /usr/src/cmd/pstat.c line
160,
229,
285,
548
- in /usr/src/cmd/ptx.c line
34,
193
- in /usr/src/cmd/refer/refer/deliv2.c line
42
- in /usr/src/cmd/refer/util/deliv2.c line
41
- in /usr/src/cmd/refer/util/hunt1.c line
123-124(2),
130
- in /usr/src/cmd/refer/util/inv5.c line
23-28(2)
- in /usr/src/cmd/refer/util/inv6.c line
19-21(2)
- in /usr/src/cmd/spell/spell.h line
78
- in /usr/src/cmd/tbl/tb.c line
36,
46,
63
- in /usr/src/cmd/uucp/4.2/uucp.h line
267
- in /usr/src/cmd/uucp/DIALUP/uucp.h line
269
- in /usr/src/cmd/uucp/chkpth.c line
123,
158
- in /usr/src/cmd/uucp/gnsys.c line
123
- in /usr/src/cmd/uucp/ulockf.c line
88
- in /usr/src/cmd/uucp/uucp.h line
268
- in /usr/src/games/fortune/strfile.c line
46,
86
- in /usr/src/games/fortune/unstr.c line
25,
44
- in /usr/src/lib/ape/util.c line
46-48(2)
- in /usr/src/lib/curses/newwin.c line
9,
36,
119-133(4)
- in /usr/src/lib/libI77/open.c line
84
- in /usr/src/sys/autoconfig/args.c line
24,
75
- in /usr/src/sys/autoconfig/read_nlist.c line
43
- in /usr/src/ucb/Mail/cmd1.c line
78-80(2)
- in /usr/src/ucb/Mail/cmd2.c line
467-468(2)
- in /usr/src/ucb/Mail/cmd3.c line
470,
484,
803-805(2)
- in /usr/src/ucb/Mail/def.h line
264
- in /usr/src/ucb/Mail/fio.c line
235
- in /usr/src/ucb/Mail/fmt.c line
23,
391
- in /usr/src/ucb/Mail/lex.c line
441
- in /usr/src/ucb/Mail/main.c line
263
- in /usr/src/ucb/Mail/strings.c line
46
- in /usr/src/ucb/Mail/vars.c line
26,
62
- in /usr/src/ucb/berknet/defs.h line
128
- in /usr/src/ucb/berknet/mach.h line
416
- in /usr/src/ucb/dump/src/dump.h line
61
- in /usr/src/ucb/dump/src/dumpitime.c line
34,
49,
109
- in /usr/src/ucb/error/errorsubr.c line
51
- in /usr/src/ucb/l11/sup.c line
95-98(2)
- in /usr/src/ucb/m11/macxrf.c line
182,
192,
257,
271-273(2)
- in /usr/src/ucb/mkstr.c line
11,
239
- in /usr/src/ucb/pwhash/src/cmd/ls.c line
428-430(2)
- in /usr/src/ucb/sysline.c line
457
- in /usr/src/ucb/xstr.c line
17,
273,
387
cfree
defined in line
28; used 57 times
Defined macros
NULL
defined in line
5; used 2 times