public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Siddhesh Poyarekar <siddhesh@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] associate a deallocation for opendir
Date: Mon, 14 Mar 2022 15:20:03 +0000 (GMT)	[thread overview]
Message-ID: <20220314152003.A10043858409@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=0e12ca024119ec6c6d2ac852a65046002efa0e80

commit 0e12ca024119ec6c6d2ac852a65046002efa0e80
Author: Steve Grubb <sgrubb@redhat.com>
Date:   Fri Mar 11 15:29:06 2022 -0500

    associate a deallocation for opendir
    
    This patch associates closedir as a deallocation for opendir and fdopendir.
    This required moving the closedir declaration above the other 2 functions.
    
    Reviewed-by: Paul Eggert <eggert@cs.ucla.edu>
    Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>

Diff:
---
 dirent/dirent.h | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/dirent/dirent.h b/dirent/dirent.h
index 218f1ed44b..c47d3273b2 100644
--- a/dirent/dirent.h
+++ b/dirent/dirent.h
@@ -126,28 +126,30 @@ enum
    The actual structure is opaque to users.  */
 typedef struct __dirstream DIR;
 
+/* Close the directory stream DIRP.
+   Return 0 if successful, -1 if not.
+
+   This function is a possible cancellation point and therefore not
+   marked with __THROW.  */
+extern int closedir (DIR *__dirp) __nonnull ((1));
+
 /* Open a directory stream on NAME.
    Return a DIR stream on the directory, or NULL if it could not be opened.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern DIR *opendir (const char *__name) __nonnull ((1));
+extern DIR *opendir (const char *__name) __nonnull ((1))
+	__attribute_malloc__ __attr_dealloc (closedir, 1);
 
 #ifdef __USE_XOPEN2K8
 /* Same as opendir, but open the stream on the file descriptor FD.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern DIR *fdopendir (int __fd);
+extern DIR *fdopendir (int __fd)
+	__attribute_malloc__ __attr_dealloc (closedir, 1);
 #endif
 
-/* Close the directory stream DIRP.
-   Return 0 if successful, -1 if not.
-
-   This function is a possible cancellation point and therefore not
-   marked with __THROW.  */
-extern int closedir (DIR *__dirp) __nonnull ((1));
-
 /* Read a directory entry from DIRP.  Return a pointer to a `struct
    dirent' describing the entry, or NULL for EOF or error.  The
    storage returned may be overwritten by a later readdir call on the


                 reply	other threads:[~2022-03-14 15:20 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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220314152003.A10043858409@sourceware.org \
    --to=siddhesh@sourceware.org \
    --cc=glibc-cvs@sourceware.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).