From f0a789b54b704fa5ce7de5f12ac54072a92e8143 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Thu, 29 Nov 2007 03:07:06 +0000 Subject: [PATCH] Split a function out to minimal and forgot to commit it. --- string.h | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 string.h diff --git a/string.h b/string.h new file mode 100644 index 0000000..c3a9724 --- /dev/null +++ b/string.h @@ -0,0 +1,7 @@ +char *strndup_(const char *src, int len) { + char *dst = malloc(len + 1); + _assert(dst != NULL); + strncpy(dst, src, len); + dst[len] = '\0'; + return dst; +} -- 2.50.0