From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org
Subject: clean-temp: Improve GCC 11 allocation-deallocation checking
Date: Sat, 07 Aug 2021 19:24:54 +0200 [thread overview]
Message-ID: <1716372.6S79mDBfko@omega> (raw)
2021-08-07 Bruno Haible <bruno@clisp.org>
clean-temp: Improve GCC 11 allocation-deallocation checking.
* lib/clean-temp.h (cleanup_temp_dir): Move declaration up.
(create_temp_dir): Declare that deallocation must happen through
'cleanup_temp_dir'.
diff --git a/lib/clean-temp.h b/lib/clean-temp.h
index db4d7fe..676c192 100644
--- a/lib/clean-temp.h
+++ b/lib/clean-temp.h
@@ -78,6 +78,11 @@ struct temp_dir
/* More fields are present here, but not public. */
};
+/* Remove all registered files and subdirectories inside DIR and DIR itself.
+ DIR cannot be used any more after this call.
+ Return 0 upon success, or -1 if there was some problem. */
+extern int cleanup_temp_dir (struct temp_dir *dir);
+
/* Create a temporary directory.
PREFIX is used as a prefix for the name of the temporary directory. It
should be short and still give an indication about the program.
@@ -89,7 +94,8 @@ struct temp_dir
is shown and NULL is returned. */
extern struct temp_dir * create_temp_dir (const char *prefix,
const char *parentdir,
- bool cleanup_verbose);
+ bool cleanup_verbose)
+ _GL_ATTRIBUTE_DEALLOC (cleanup_temp_dir, 1);
/* Register the given ABSOLUTE_FILE_NAME as being a file inside DIR, that
needs to be removed before DIR can be removed.
@@ -130,11 +136,6 @@ extern int cleanup_temp_subdir (struct temp_dir *dir,
Return 0 upon success, or -1 if there was some problem. */
extern int cleanup_temp_dir_contents (struct temp_dir *dir);
-/* Remove all registered files and subdirectories inside DIR and DIR itself.
- DIR cannot be used any more after this call.
- Return 0 upon success, or -1 if there was some problem. */
-extern int cleanup_temp_dir (struct temp_dir *dir);
-
/* ================== Opening and closing temporary files ================== */
/* Open a temporary file in a temporary directory.
reply other threads:[~2021-08-07 17:25 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1716372.6S79mDBfko@omega \
--to=bruno@clisp.org \
--cc=bug-gnulib@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).