From fe15063a016258d81bf3cec3754ee41a1d317a3b Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 7 Aug 2021 21:55:00 +0200 Subject: [PATCH] readline: Improve GCC 11 allocation-deallocation checking. * lib/readline.h: Include . (readline): Declare that deallocation must happen through 'free'. --- ChangeLog | 6 ++++++ lib/readline.h | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index baaad7c76a..8ce06c44db 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2021-08-07 Bruno Haible + + readline: Improve GCC 11 allocation-deallocation checking. + * lib/readline.h: Include . + (readline): Declare that deallocation must happen through 'free'. + 2021-08-07 Bruno Haible read-file: Improve GCC 11 allocation-deallocation checking. diff --git a/lib/readline.h b/lib/readline.h index 57acdf75c3..e4b6f9b6b7 100644 --- a/lib/readline.h +++ b/lib/readline.h @@ -24,11 +24,13 @@ # include # include #else +# include /* Prints a prompt PROMPT and then reads and returns a single line of text from the user. If PROMPT is NULL or the empty string, no prompt is displayed. The returned line is allocated with malloc; the caller should free the line when it has finished with it. */ -extern char *readline (const char *prompt); +extern char *readline (const char *prompt) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE; #endif #endif /* GL_READLINE_H */ -- 2.39.5