Skip to content

Commit

Permalink
smalloc: add a comment explaining why scalloc does not zero memory
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
vincentkfu committed Jun 12, 2024
1 parent a151187 commit bd7492a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions smalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit bd7492a

Please sign in to comment.