home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 9
/
FreshFishVol9-CD2.bin
/
bbs
/
gnu
/
libnix-0.8-src.lha
/
libnix-0.8
/
sources
/
nix
/
stdlib
/
calloc.c
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
C/C++ Source or Header
|
1994-12-12
|
351 b
|
19 lines
#include <stdio.h>
#include <stdlib.h>
void *calloc(unsigned long nmemb,unsigned long size)
{
unsigned long l;
unsigned long *a;
void *b;
l=(nmemb*size+(sizeof(unsigned long)-1))&~(sizeof(unsigned long)-1);
a=(unsigned long *)(b=malloc(l));
if(b!=NULL)
{
do
*a++=0;
while((l-=sizeof(unsigned long))!=0);
}
return b;
}