diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-12-10 02:21:00 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-12-10 02:21:00 +0100 |
commit | 7179f51176e1f3af53694e09d7ea2ca602403cf1 (patch) | |
tree | db24424529090c7ac819e2ec9724c855dbb2d53e /doc | |
parent | typo (diff) | |
download | mds-7179f51176e1f3af53694e09d7ea2ca602403cf1.tar.gz mds-7179f51176e1f3af53694e09d7ea2ca602403cf1.tar.bz2 mds-7179f51176e1f3af53694e09d7ea2ca602403cf1.tar.xz |
no more direct allocations, always use macros, unless using alloca
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/info/mds.texinfo | 30 |
1 files changed, 28 insertions, 2 deletions
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 |