]> Savannah Git Hosting - gnulib.git/commitdiff
[x]concat-filename: Improve GCC 11 allocation-deallocation checking.
authorBruno Haible <bruno@clisp.org>
Sat, 7 Aug 2021 17:27:05 +0000 (19:27 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 7 Aug 2021 17:27:05 +0000 (19:27 +0200)
* lib/concat-filename.h: Include <stdlib.h>.
(concatenated_filename, xconcatenated_filename): Declare that
deallocation must happen through 'free'.

ChangeLog
lib/concat-filename.h

index 67019f31b1943a66ae2750abfa8f182b1afb65c0..29f41d707b343fe9112c785622a9b42595771691 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2021-08-07  Bruno Haible  <bruno@clisp.org>
+
+       [x]concat-filename: Improve GCC 11 allocation-deallocation checking.
+       * lib/concat-filename.h: Include <stdlib.h>.
+       (concatenated_filename, xconcatenated_filename): Declare that
+       deallocation must happen through 'free'.
+
 2021-08-07  Bruno Haible  <bruno@clisp.org>
 
        clean-temp: Improve GCC 11 allocation-deallocation checking.
index 5a7d3934a0964f1b4fcb153ea2d6c12df177322f..32a437ec60ac036f17b804934651ba5e350f10e6 100644 (file)
@@ -17,6 +17,8 @@
 #ifndef _CONCAT_FILENAME_H
 #define _CONCAT_FILENAME_H
 
+#include <stdlib.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -26,12 +28,15 @@ extern "C" {
    suffix.  Return a freshly allocated filename.  Return NULL and set errno
    upon memory allocation failure.  */
 extern char *concatenated_filename (const char *directory,
-                                    const char *filename, const char *suffix);
+                                    const char *filename, const char *suffix)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
 
 /* Concatenate a directory filename, a relative filename and an optional
    suffix.  Return a freshly allocated filename.  */
 extern char *xconcatenated_filename (const char *directory,
-                                     const char *filename, const char *suffix);
+                                     const char *filename, const char *suffix)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+  _GL_ATTRIBUTE_RETURNS_NONNULL;
 
 
 #ifdef __cplusplus