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 deallocator for iconv_open
Date: Mon, 14 Mar 2022 15:20:08 +0000 (GMT)	[thread overview]
Message-ID: <20220314152008.BFF8E3858418@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=260a430dd841072020c4dae91468322e619e7330

commit 260a430dd841072020c4dae91468322e619e7330
Author: Steve Grubb <sgrubb@redhat.com>
Date:   Fri Mar 11 17:04:46 2022 -0500

    associate a deallocator for iconv_open
    
    This patch associates iconv_close as a deallocator for iconv_open. This
    required moving the iconv_close declaration above iconv_open.
    
    Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>

Diff:
---
 iconv/iconv.h | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/iconv/iconv.h b/iconv/iconv.h
index aa936a350f..544425d4dc 100644
--- a/iconv/iconv.h
+++ b/iconv/iconv.h
@@ -29,12 +29,19 @@ __BEGIN_DECLS
 typedef void *iconv_t;
 
 
+/* Free resources allocated for descriptor CD for code conversion.
+
+   This function is a possible cancellation point and therefore not
+   marked with __THROW.  */
+extern int iconv_close (iconv_t __cd);
+
 /* Allocate descriptor for code conversion from codeset FROMCODE to
    codeset TOCODE.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern iconv_t iconv_open (const char *__tocode, const char *__fromcode);
+extern iconv_t iconv_open (const char *__tocode, const char *__fromcode)
+	__attribute_malloc__ __attr_dealloc (iconv_close, 1);
 
 /* Convert at most *INBYTESLEFT bytes from *INBUF according to the
    code conversion algorithm specified by CD and place up to
@@ -44,12 +51,6 @@ extern size_t iconv (iconv_t __cd, char **__restrict __inbuf,
 		     char **__restrict __outbuf,
 		     size_t *__restrict __outbytesleft);
 
-/* Free resources allocated for descriptor CD for code conversion.
-
-   This function is a possible cancellation point and therefore not
-   marked with __THROW.  */
-extern int iconv_close (iconv_t __cd);
-
 __END_DECLS
 
 #endif /* iconv.h */


                 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=20220314152008.BFF8E3858418@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).