aboutsummaryrefslogtreecommitdiffstats
path: root/xmalloc.h
diff options
context:
space:
mode:
Diffstat (limited to 'xmalloc.h')
-rw-r--r--xmalloc.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/xmalloc.h b/xmalloc.h
index 690b5741..81835828 100644
--- a/xmalloc.h
+++ b/xmalloc.h
@@ -25,4 +25,10 @@ XMALLOCTYPE *xrealloc(/*@null@*/ XMALLOCTYPE *, size_t n);
* pointer, abort program on failure. */
char *xstrdup(const char *src);
+/** Duplicate at most the first \a n characters from \a src to a newly
+ * malloc()d memory region and NUL-terminate it, and return its pointer, abort
+ * program on failure. The memory size is the lesser of either the string
+ * length including NUL byte or n + 1. */
+char *xstrndup(const char *src, size_t n);
+
#endif