ialloc: Prepare for allocation-deallocation checking.
authorBruno Haible <bruno@clisp.org>
Sat, 7 Aug 2021 22:11:49 +0000 (00:11 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 7 Aug 2021 22:11:49 +0000 (00:11 +0200)
* lib/ialloc.h (imalloc, irealloc, icalloc): Add comment that
deallocation must happen through 'free'.

ChangeLog
lib/ialloc.h

index be558220e8327f6cb95e1eb3361b6edd57292392..0355389b85e03ea8f87d3b35e5076af6ee4ce8bb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2021-08-07  Bruno Haible  <bruno@clisp.org>
+
+       ialloc: Prepare for allocation-deallocation checking.
+       * lib/ialloc.h (imalloc, irealloc, icalloc): Add comment that
+       deallocation must happen through 'free'.
+
 2021-08-07  Bruno Haible  <bruno@clisp.org>
 
        aligned-malloc: Prepare for allocation-deallocation checking.
index ebe4aaa3cf485b92139aba8c8775fc462d89a7d3..5ceda4633a710ea8f6bb7a5e5da5936ea5d69043 100644 (file)
@@ -43,13 +43,17 @@ _gl_alloc_nomem (void)
   return NULL;
 }
 
-IALLOC_INLINE void *
+IALLOC_INLINE
+_GL_ATTRIBUTE_MALLOC /*_GL_ATTRIBUTE_DEALLOC_FREE*/
+void *
 imalloc (idx_t s)
 {
   return s <= SIZE_MAX ? malloc (s) : _gl_alloc_nomem ();
 }
 
-IALLOC_INLINE void *
+IALLOC_INLINE
+/*_GL_ATTRIBUTE_DEALLOC_FREE*/
+void *
 irealloc (void *p, idx_t s)
 {
   /* Work around GNU realloc glitch by treating a zero size as if it
@@ -57,7 +61,9 @@ irealloc (void *p, idx_t s)
   return s <= SIZE_MAX ? realloc (p, s | !s) : _gl_alloc_nomem ();
 }
 
-IALLOC_INLINE void *
+IALLOC_INLINE
+_GL_ATTRIBUTE_MALLOC /*_GL_ATTRIBUTE_DEALLOC_FREE*/
+void *
 icalloc (idx_t n, idx_t s)
 {
   if (SIZE_MAX < n)