From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org
Subject: pipe-filter-gi: Improve GCC 11 allocation-deallocation checking
Date: Sat, 07 Aug 2021 21:50:56 +0200 [thread overview]
Message-ID: <4217162.T5AuPNMGXD@omega> (raw)
2021-08-07 Bruno Haible <bruno@clisp.org>
pipe-filter-gi: Improve GCC 11 allocation-deallocation checking.
* lib/pipe-filter.h (pipe_filter_gi_close): Move declaration up.
(pipe_filter_gi_create): Declare that deallocation must happen through
'pipe_filter_gi_close'.
diff --git a/lib/pipe-filter.h b/lib/pipe-filter.h
index 614b9e0..c308cf3 100644
--- a/lib/pipe-filter.h
+++ b/lib/pipe-filter.h
@@ -152,6 +152,23 @@ struct pipe_filter_ig;
struct pipe_filter_gi;
+/* Finish reading the output via the prepare_read/done_read functions
+ specified to pipe_filter_gi_create.
+
+ Note that the prepare_read/done_read functions may be called in a
+ different thread than the current thread (depending on the platform).
+ However, they will always be called before pipe_filter_gi_close has
+ returned.
+
+ The write side of the pipe is closed as soon as pipe_filter_gi_close
+ starts, while the read side will be closed just before it finishes.
+
+ Return 0 upon success, or (only if exit_on_error is false):
+ - -1 with errno set upon failure,
+ - the positive exit code of the subprocess if that failed. */
+extern int
+ pipe_filter_gi_close (struct pipe_filter_gi *filter);
+
/* Create a subprocess and pipe some data through it.
Arguments:
- progname is the program name used in error messages.
@@ -185,7 +202,8 @@ extern struct pipe_filter_gi *
bool null_stderr, bool exit_on_error,
prepare_read_fn prepare_read,
done_read_fn done_read,
- void *private_data);
+ void *private_data)
+ _GL_ATTRIBUTE_DEALLOC (pipe_filter_gi_close, 1);
/* Write size bytes starting at buf into the pipe and in the meanwhile
possibly call the prepare_read and done_read functions specified to
@@ -207,23 +225,6 @@ extern int
pipe_filter_gi_write (struct pipe_filter_gi *filter,
const void *buf, size_t size);
-/* Finish reading the output via the prepare_read/done_read functions
- specified to pipe_filter_gi_create.
-
- Note that the prepare_read/done_read functions may be called in a
- different thread than the current thread (depending on the platform).
- However, they will always be called before pipe_filter_gi_close has
- returned.
-
- The write side of the pipe is closed as soon as pipe_filter_gi_close
- starts, while the read side will be closed just before it finishes.
-
- Return 0 upon success, or (only if exit_on_error is false):
- - -1 with errno set upon failure,
- - the positive exit code of the subprocess if that failed. */
-extern int
- pipe_filter_gi_close (struct pipe_filter_gi *filter);
-
/* ============================ pipe_filter_gg ============================ */
reply other threads:[~2021-08-07 19:51 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=4217162.T5AuPNMGXD@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).