From: Jeff King Date: Mon, 30 Apr 2007 20:50:50 GMT Subject: Re: [PATCH 1/5] Make xstrndup common Message-ID: <20070430205050.GC4385@coredump.intra.peff.net> In-Reply-To: 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. -Peff