mailing list of musl libc
 help / color / mirror / code / Atom feed
b162d8be05493e3a207f69f5c85067514a16fe9c blob 250 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
 
#include <stdlib.h>
#include <string.h>
#include "libc.h"

char *__strndup(const char *s, size_t n)
{
	size_t l = strnlen(s, n);
	char *d = malloc(l+1);
	if (!d) return NULL;
	memcpy(d, s, l);
	d[l] = 0;
	return d;
}

weak_alias(__strndup, strndup);
debug log:

solving b162d8b ...
found b162d8b in https://inbox.vuxu.org/musl/20120722183828.20b71c9d@newbook/
found 617d27b in https://git.vuxu.org/mirror/musl/
preparing index
index prepared:
100644 617d27ba9e65ba384fa97433e90b1632015ee998	src/string/strndup.c

applying [1/1] https://inbox.vuxu.org/musl/20120722183828.20b71c9d@newbook/
diff --git a/src/string/strndup.c b/src/string/strndup.c
index 617d27b..b162d8b 100644

Checking patch src/string/strndup.c...
Applied patch src/string/strndup.c cleanly.

index at:
100644 b162d8be05493e3a207f69f5c85067514a16fe9c	src/string/strndup.c

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).