From 344273a7e0a6899451836e6072fecebea4a6ac24 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 10 Dec 2014 02:58:25 +0100 Subject: add xmemdup macro MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- doc/info/mds.texinfo | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/info/mds.texinfo b/doc/info/mds.texinfo index cb6ac6d..09880c4 100644 --- a/doc/info/mds.texinfo +++ b/doc/info/mds.texinfo @@ -3942,7 +3942,7 @@ an auxiliary @code{type*} variable and specify it in as the @code{old} parameter. Returns zero on and only on success. -@item @code{xstrdup} [(@code{char* var, const char original}) @arrow{} @code{int}] +@item @code{xstrdup} [(@code{char* var, const char* original}) @arrow{} @code{int}] Wrapper for @code{strdup} that returns zero on and only on success. @code{original} is duplicate and the @@ -3951,6 +3951,15 @@ duplicate is stored in the variable @code{NULL}, @code{var} is set to @code{NULL} and zero is returned. +@item @code{xmemdup} [(@code{void* var, const void* original, size_t elements, type}) @arrow{} @code{int}] +Allocates a pointer of the type @code{type*} +with room for @code{elements} elements and +stores the pointer to @code{var}. If successful, +the content of @code{original} (@code{elements} +elements of size @code{sizeof(type*)}) is +copied to @code{var}, and zero is returned. +On failure, a non-zero value is returned. + @item @code{xperror} [(@code{const char* str}) @arrow{} @code{void}] Invokes @code{perror(str)} if and only if @code{errno} is non-zero and then sets -- cgit v1.2.3-70-g09d2