From 651410e54cb9a478f2fbb16cb493a5e7808ad8fe Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Sun, 25 Oct 2020 10:41:18 +0100 Subject: util: introduce xstrndup helper We already have xstrdup, add xstrndup as well to make it straight-forward to clone part of a string. Signed-off-by: Ahmad Fatoum --- util.h | 1 + 1 file changed, 1 insertion(+) (limited to 'util.h') diff --git a/util.h b/util.h index 7a4e910..9d38ede 100644 --- a/util.h +++ b/util.h @@ -61,6 +61,7 @@ static inline void *xrealloc(void *p, size_t len) } extern char *xstrdup(const char *s); +extern char *xstrndup(const char *s, size_t len); extern int PRINTF(2, 3) xasprintf(char **strp, const char *fmt, ...); extern int PRINTF(2, 3) xasprintf_append(char **strp, const char *fmt, ...); -- cgit v1.1