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