Re: [PATCH 1/5] Make xstrndup common
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Apr 30, 2007, 22:21 UTC
- Message-ID
- <Pine.LNX.4.64.0705010020070.29859@racer.site>
- In-Reply-To
- <20070430205050.GC4385@coredump.intra.peff.net>
Hi,
On Mon, 30 Apr 2007, Jeff King wrote:
Show 16 quoted lines
> On Mon, Apr 30, 2007 at 03:12:50PM +0200, Johannes Schindelin wrote:
>
> > 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.D'oh! I never thought this was a GNU-ism.
Ciao, Dscho