diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-12-10 02:58:25 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-12-10 02:58:25 +0100 |
commit | 344273a7e0a6899451836e6072fecebea4a6ac24 (patch) | |
tree | ea24fa9e12ae6dad40eeb6470c92545e14f0f8cf /doc/info/mds.texinfo | |
parent | no more direct allocations, always use macros, unless using alloca (diff) | |
download | mds-344273a7e0a6899451836e6072fecebea4a6ac24.tar.gz mds-344273a7e0a6899451836e6072fecebea4a6ac24.tar.bz2 mds-344273a7e0a6899451836e6072fecebea4a6ac24.tar.xz |
add xmemdup macro
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'doc/info/mds.texinfo')
-rw-r--r-- | doc/info/mds.texinfo | 11 |
1 files changed, 10 insertions, 1 deletions
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 |