X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=xmalloc.h;h=818358285033195e1033b222188508468a32bb0a;hb=d31db10231e9ed89f64fdf6e0fb7cae182aa377e;hp=690b574199af4313deb6d1c95689f309e6d5661c;hpb=0c92635914becb4f6913c3f1d5a6f3756325315b;p=~andy%2Ffetchmail 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