From: Jay Freeman (saurik) Date: Thu, 29 Nov 2007 03:07:06 +0000 (+0000) Subject: Split a function out to minimal and forgot to commit it. X-Git-Url: https://git.saurik.com/minimal.git/commitdiff_plain/f0a789b54b704fa5ce7de5f12ac54072a92e8143 Split a function out to minimal and forgot to commit it. --- 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; +}