]> Savannah Git Hosting - gnulib.git/commitdiff
ialloc: Add comments.
authorBruno Haible <bruno@clisp.org>
Tue, 28 Mar 2023 00:18:02 +0000 (02:18 +0200)
committerBruno Haible <bruno@clisp.org>
Tue, 28 Mar 2023 00:18:02 +0000 (02:18 +0200)
* lib/ialloc.h (imalloc, irealloc, icalloc, ireallocarray): Add
comments.

ChangeLog
lib/ialloc.h

index 89736b2d990b27571341126e80b9d2ed0dd5c9de..80a07ae33058db20d81421ab823fb2a1914d40df 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-03-27  Bruno Haible  <bruno@clisp.org>
+
+       ialloc: Add comments.
+       * lib/ialloc.h (imalloc, irealloc, icalloc, ireallocarray): Add
+       comments.
+
 2023-03-27  Paul Eggert  <eggert@cs.ucla.edu>
 
        Support FALLTHROUGH macro better in glibc+clang.
index 1d43faf388038258d6fb677f7275d4c50ec28bb1..275237ccb1ca770e5ca99c77303d6af6ea959a44 100644 (file)
@@ -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)
 {