Root/
Source at commit 1313 created 12 years 9 months ago. By meklort, Add TIXML_USE_STL to TinyXML | |
---|---|
1 | /*␊ |
2 | * calloc.c␊ |
3 | */␊ |
4 | ␊ |
5 | #include <stdlib.h>␊ |
6 | #include <string.h>␊ |
7 | /* FIXME: This should look for multiplication overflow */␊ |
8 | ␊ |
9 | void *calloc(size_t nmemb, size_t size)␊ |
10 | {␊ |
11 | ␉void *ptr;␊ |
12 | ␊ |
13 | ␉size *= nmemb;␊ |
14 | ␉ptr = malloc(size);␊ |
15 | ␉if (ptr)␊ |
16 | ␉␉memset(ptr, 0, size);␊ |
17 | ␊ |
18 | ␉return ptr;␊ |
19 | }␊ |
20 |