mirror of
https://github.com/diegocr/libnix.git
synced 2026-09-12 11:40:30 +00:00
18 lines
276 B
C
18 lines
276 B
C
#include <stdlib.h>
|
|
|
|
void *calloc(size_t nmemb,size_t size)
|
|
{
|
|
size_t l;
|
|
size_t *a;
|
|
void *b;
|
|
l=(nmemb*size+(sizeof(size_t)-1))&~(sizeof(size_t)-1);
|
|
a=(size_t *)(b=malloc(l));
|
|
if(b!=NULL)
|
|
{
|
|
do
|
|
*a++=0;
|
|
while((l-=sizeof(size_t))!=0);
|
|
}
|
|
return b;
|
|
}
|