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

Q: xasprintf

From
Dmitry V. Levin <ldv@altlinux.org>
Date
May 23, 2006, 11:28 UTC
Message-ID
<20060523112854.GD5582@basalt.office.altlinux.org>
In-Reply-To
<7vzmh98seo.fsf@assigned-by-dhcp.cox.net>
Hi,
On Mon, May 22, 2006 at 06:02:39PM -0700, Junio C Hamano wrote:
> Sean <seanlkml@sympatico.ca> writes:
[...]
Show 6 quoted lines
> > -		name = xmalloc(len_a + len_b - pfx_length - sfx_length + 7);
> > +		name = xmalloc(pfx_length + a_midlen + b_midlen + sfx_length + 7);
> >  		sprintf(name, "%.*s{%.*s => %.*s}%s",
> 
> Obviously correct given what the sprintf() that immediately
> follows does.  Sheesh, what was I smoking back then.  *BLUSH*
What about introducing xasprintf() to eliminate such issues?
-- 
ldv
Previous: Junio C HamanoNext: Torgil Svensson
Message 4 of 5 in “git-diff-tree crashes on ubuntu kernel git repository”
  1. Torgil SvenssonMay 22, 2006
  2. Avoid segfault in diff --stat rename output.Sean, May 23, 2006
  3. Junio C HamanoMay 23, 2006
  4. Q: xasprintfDmitry V. Levin, May 23, 2006
  5. Torgil SvenssonMay 23, 2006

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.