X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=functions%2Fstdlib%2Fcalloc.c;h=4169f84c60c8ff80ea338a13dd50044e8ad85bb7;hp=5470427f4c3306d9caeb31a8744caf746184db0e;hb=0a5395faab237ba9008352b0f4bee9659bbd3d5f;hpb=34893ecc2200dc7017c36a54cb6c5f4c2378b5ec diff --git a/functions/stdlib/calloc.c b/functions/stdlib/calloc.c index 5470427..4169f84 100644 --- a/functions/stdlib/calloc.c +++ b/functions/stdlib/calloc.c @@ -6,3 +6,29 @@ // ---------------------------------------------------------------------------- void * calloc( size_t nelem, size_t size ) { /* TODO */ }; + +/* PDPC code - unreviewed +{ + void *ptr; + size_t total; + + if (nmemb == 1) + { + total = size; + } + else if (size == 1) + { + total = nmemb; + } + else + { + total = nmemb * size; + } + ptr = malloc(total); + if (ptr != NULL) + { + memset(ptr, '\0', total); + } + return (ptr); +} +*/ \ No newline at end of file