From: Bruno Haible Date: Tue, 28 Mar 2023 00:18:02 +0000 (+0200) Subject: ialloc: Add comments. X-Git-Tag: v1.0~1559 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=c86bdc1ca028f244b70c47138c1d7cfa238ee1a9;p=gnulib.git ialloc: Add comments. * lib/ialloc.h (imalloc, irealloc, icalloc, ireallocarray): Add comments. --- diff --git a/ChangeLog b/ChangeLog index 89736b2d99..80a07ae330 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2023-03-27 Bruno Haible + + ialloc: Add comments. + * lib/ialloc.h (imalloc, irealloc, icalloc, ireallocarray): Add + comments. + 2023-03-27 Paul Eggert Support FALLTHROUGH macro better in glibc+clang. diff --git a/lib/ialloc.h b/lib/ialloc.h index 1d43faf388..275237ccb1 100644 --- a/lib/ialloc.h +++ b/lib/ialloc.h @@ -43,6 +43,9 @@ _gl_alloc_nomem (void) return NULL; } +/* imalloc (size) is like malloc (size). + It returns a non-NULL pointer to size bytes of memory. + Upon failure, it returns NULL with errno set. */ IALLOC_INLINE _GL_ATTRIBUTE_MALLOC /*_GL_ATTRIBUTE_DEALLOC_FREE*/ void * @@ -51,6 +54,9 @@ imalloc (idx_t s) return s <= SIZE_MAX ? malloc (s) : _gl_alloc_nomem (); } +/* irealloc (ptr, size) is like realloc (ptr, size). + It returns a non-NULL pointer to size bytes of memory. + Upon failure, it returns NULL with errno set. */ IALLOC_INLINE /*_GL_ATTRIBUTE_DEALLOC_FREE*/ void * @@ -61,6 +67,9 @@ irealloc (void *p, idx_t s) return s <= SIZE_MAX ? realloc (p, s | !s) : _gl_alloc_nomem (); } +/* icalloc (num, size) is like calloc (num, size). + It returns a non-NULL pointer to num * size bytes of memory. + Upon failure, it returns NULL with errno set. */ IALLOC_INLINE _GL_ATTRIBUTE_MALLOC /*_GL_ATTRIBUTE_DEALLOC_FREE*/ void * @@ -81,6 +90,9 @@ icalloc (idx_t n, idx_t s) return calloc (n, s); } +/* ireallocarray (ptr, num, size) is like reallocarray (ptr, num, size). + It returns a non-NULL pointer to num * size bytes of memory. + Upon failure, it returns NULL with errno set. */ IALLOC_INLINE void * ireallocarray (void *p, idx_t n, idx_t s) {