From 7179f51176e1f3af53694e09d7ea2ca602403cf1 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 10 Dec 2014 02:21:00 +0100 Subject: no more direct allocations, always use macros, unless using alloca 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 | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'doc') diff --git a/doc/info/mds.texinfo b/doc/info/mds.texinfo index 6f30a39..cb6ac6d 100644 --- a/doc/info/mds.texinfo +++ b/doc/info/mds.texinfo @@ -3884,15 +3884,24 @@ requires @code{size_t i} is declared. @item @code{xmalloc} [(@code{type* var, size_t elements, type}) @arrow{} @code{int}] Allocates a @code{type*} with @code{elements} -elements and store the allocated pointer to +elements and stores the allocated pointer to @code{var}. Returns zero on and only on success. +@item @code{xbmalloc} [(@code{type* var, size_t bytes}) @arrow{} @code{int}] +Allocates @code{bytes} bytes and stores the allocated +pointer to @code{var}. Returns zero on and only on success. + @item @code{xcalloc} [(@code{type* var, size_t elements, type}) @arrow{} @code{int}] Allocates a zero-initialised @code{type*} with -@code{elements} elements and store the allocated +@code{elements} elements and stores the allocated pointer to @code{var}. Returns zero on and only on success. +@item @code{xbcalloc} [(@code{type* var, size_t bytes}) @arrow{} @code{int}] +Allocates and zero-initialises @code{bytes} bytess +and stores the allocated pointer to @code{var}. +Returns zero on and only on success. + @item @code{xrealloc} [(@code{type* var, size_t elements, type}) @arrow{} @code{int}] Reallocates @code{var} and updates the variable @code{var} accordingly. @code{var} will be @@ -3913,6 +3922,14 @@ on success, and @code{old} set to @code{var} on error. Like @code{xrealloc}, @code{xxrealloc} returns zero on and only on success. +@item @code{yrealloc} [(@code{type* tmp, type* var, size_t elements, type}) @arrow{} @code{int}] +Variant of @code{xrealloc} that will +store @code{var} to @code{tmp} before +reallocating @code{var} and then restore +@code{var} if the reallocation failed. +Like @code{xrealloc}, @code{yrealloc} +returns zero on and only on success. + @item @code{growalloc} [(@code{type* old, type* var, size_t elements, type}) @arrow{} @code{int}] When using this macro @code{var} should be a @code{type*} pointer allocated for @@ -3925,6 +3942,15 @@ 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}] +Wrapper for @code{strdup} that +returns zero on and only on success. +@code{original} is duplicate and the +duplicate is stored in the variable +@code{var}. If @code{original} is +@code{NULL}, @code{var} is set to +@code{NULL} and zero 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