]> git.saurik.com Git - minimal.git/commitdiff
Split a function out to minimal and forgot to commit it.
authorJay Freeman (saurik) <saurik@saurik.com>
Thu, 29 Nov 2007 03:07:06 +0000 (03:07 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Thu, 29 Nov 2007 03:07:06 +0000 (03:07 +0000)
string.h [new file with mode: 0644]

diff --git a/string.h b/string.h
new file mode 100644 (file)
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;
+}