* [Patch] associate a deallocator for iconv_open
@ 2022-03-11 22:04 Steve Grubb
2022-03-14 8:13 ` Siddhesh Poyarekar
0 siblings, 1 reply; 2+ messages in thread
From: Steve Grubb @ 2022-03-11 22:04 UTC (permalink / raw)
To: libc-alpha
This patch associates iconv_close as a deallocator for iconv_open. This
required moving the iconv_close declaration above iconv_open.
---
iconv.h | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
---
diff -urp glibc-2.35.9000-111-g2bbc694df2.orig/iconv/iconv.h glibc-2.35.9000-111-g2bbc694df2/iconv/iconv.h
--- glibc-2.35.9000-111-g2bbc694df2.orig/iconv/iconv.h 2022-02-28 10:47:38.000000000 -0500
+++ glibc-2.35.9000-111-g2bbc694df2/iconv/iconv.h 2022-03-11 15:06:20.679084344 -0500
@@ -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
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 */
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Patch] associate a deallocator for iconv_open
2022-03-11 22:04 [Patch] associate a deallocator for iconv_open Steve Grubb
@ 2022-03-14 8:13 ` Siddhesh Poyarekar
0 siblings, 0 replies; 2+ messages in thread
From: Siddhesh Poyarekar @ 2022-03-14 8:13 UTC (permalink / raw)
To: Steve Grubb, libc-alpha
On 12/03/2022 03:34, Steve Grubb via Libc-alpha wrote:
> This patch associates iconv_close as a deallocator for iconv_open. This
> required moving the iconv_close declaration above iconv_open.
LGTM. I'll push once I finish testing.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
>
> ---
> iconv.h | 15 ++++++++-------
> 1 file changed, 8 insertions(+), 7 deletions(-)
> ---
> diff -urp glibc-2.35.9000-111-g2bbc694df2.orig/iconv/iconv.h glibc-2.35.9000-111-g2bbc694df2/iconv/iconv.h
> --- glibc-2.35.9000-111-g2bbc694df2.orig/iconv/iconv.h 2022-02-28 10:47:38.000000000 -0500
> +++ glibc-2.35.9000-111-g2bbc694df2/iconv/iconv.h 2022-03-11 15:06:20.679084344 -0500
> @@ -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
> 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 */
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-03-14 8:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-11 22:04 [Patch] associate a deallocator for iconv_open Steve Grubb
2022-03-14 8:13 ` Siddhesh Poyarekar
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).