smalloc: add a comment explaining why scalloc does not zero memory
authorVincent Fu <vincent.fu@samsung.com>
Wed, 12 Jun 2024 17:06:09 +0000 (13:06 -0400)
committerVincent Fu <vincent.fu@samsung.com>
Wed, 12 Jun 2024 17:06:09 +0000 (13:06 -0400)
scalloc does not zero out the buffer because this is already done
elsewhere. Explain this in a comment because this could be confusing.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
smalloc.c

index 23243054ec7ab401ee7d89d73db81d3d809dd612..ac7ef70168cf4bb8a5c260e1b1ffac5fd7badc8b 100644 (file)
--- a/smalloc.c
+++ b/smalloc.c
@@ -566,6 +566,10 @@ void *smalloc(size_t size)
 
 void *scalloc(size_t nmemb, size_t size)
 {
+       /*
+        * smalloc_pool (called by smalloc) will zero the memory, so we don't
+        * need to do it here.
+        */
        return smalloc(nmemb * size);
 }