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

Re: [PATCH 1/5] Make xstrndup common

From
Jeff King <peff@peff.net>
Date
Apr 30, 2007, 20:50 UTC
Message-ID
<20070430205050.GC4385@coredump.intra.peff.net>
In-Reply-To
<Pine.LNX.4.64.0704301508550.29859@racer.site>
On Mon, Apr 30, 2007 at 03:12:50PM +0200, Johannes Schindelin wrote:
Show 11 quoted lines
> Unless I am missing something, I think this should work:
> 
> static inline char *xstrndup(const char *str, int len)
> {
> 	char *result = strndup(str, len);
> 	if (result == NULL)
> 		die ("xstrndup(): out of memory");
> 	return result;
> }
> 
> Hmm?

I can't speak for the original authors, but I imagine part of the impetus was that strndup is a GNU-ism.

-Peff
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 8 of 9 in “Re: [PATCH 1/5] Make xstrndup common”
  1. Josh TriplettApr 28, 2007
  2. Junio C HamanoApr 28, 2007
  3. Daniel BarkalowApr 29, 2007
  4. Josh TriplettApr 29, 2007
  5. Junio C HamanoApr 29, 2007
  6. Adam RobenApr 29, 2007
  7. Johannes SchindelinApr 30, 2007
  8. Jeff KingApr 30, 2007
  9. Johannes SchindelinApr 30, 2007

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.