diff options
Diffstat (limited to 'com32/lib/calloc.c')
-rw-r--r-- | com32/lib/calloc.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/com32/lib/calloc.c b/com32/lib/calloc.c new file mode 100644 index 00000000..228a1b70 --- /dev/null +++ b/com32/lib/calloc.c @@ -0,0 +1,21 @@ +/* + * calloc.c + */ + +#include <stdlib.h> +#include <string.h> + +/* FIXME: This should look for multiplication overflow */ + +void *calloc(size_t nmemb, size_t size) +{ + void *ptr; + + size *= nmemb; + ptr = malloc(size); + if ( ptr ) + memset(ptr, 0, size); + + return ptr; +} + |