git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Replace xmalloc/memset(0) pairs with xcalloc

From
Andreas Ericsson <ae@op5.se>
Date
Oct 7, 2008, 05:12 UTC
Message-ID
<48EAEFAE.3010504@op5.se>
In-Reply-To
<48R7WYLSZ5lElWvJbfurso2ZPBQbzSCmtOgIsqTWyaA8yfW6Ndq1aA@cipher.nrlssc.navy.mil>
Brandon Casey wrote:
> Many call sites immediately initialize allocated memory with zero after
> calling xmalloc. A single call to xcalloc can replace this two-call
> sequence.
> 

Nicely done. Apart from reducing LoC count, this is also a slight optimization as we'll no longer bzero() memory handed to us directly by the kernel (which is already nul'ed out).

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
Previous: Brandon Casey
Message 2 of 2 in “Replace xmalloc/memset(0) pairs with xcalloc”
  1. Replace xmalloc/memset(0) pairs with xcallocBrandon Casey, Oct 6, 2008
  2. Andreas EricssonOct 7, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.