Thread (8 messages) flat view 8 messages, 5 authors, 2016-06-15

Re: [PATCH 1/5] Make xstrndup common

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:43:07

Hi,

On Mon, 30 Apr 2007, Jeff King wrote:
On Mon, Apr 30, 2007 at 03:12:50PM +0200, Johannes Schindelin wrote:
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help