From f7f1e3cfa25cf95e15bac30e6934d5a534ceca08 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Tue, 3 Sep 2019 17:07:58 -0400 Subject: dstring: New dstrndup() function --- dstring.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'dstring.h') diff --git a/dstring.h b/dstring.h index 22476b9..19fd6d7 100644 --- a/dstring.h +++ b/dstring.h @@ -40,6 +40,16 @@ char *dstralloc(size_t capacity); */ char *dstrdup(const char *str); +/** + * Create a length-limited dynamic copy of a string. + * + * @param str + * The string to copy. + * @param n + * The maximum number of characters to copy from str. + */ +char *dstrndup(const char *str, size_t n); + /** * Get a dynamic string's length. * -- cgit v1.2.3