X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstdlib%2Fcalloc.c;h=4169f84c60c8ff80ea338a13dd50044e8ad85bb7;hb=d7cc1957de74235bd2a84c1ef26ecab2368f57e4;hp=5470427f4c3306d9caeb31a8744caf746184db0e;hpb=dcc8a8e99f69e090a03b7b868443addbc0817820;p=pdclib.old 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