aboutsummaryrefslogtreecommitdiff
path: root/iconv/iconv.h
diff options
context:
space:
mode:
authorSteve Grubb <sgrubb@redhat.com>2022-03-11 17:04:46 -0500
committerSiddhesh Poyarekar <siddhesh@sourceware.org>2022-03-14 20:02:49 +0530
commit260a430dd841072020c4dae91468322e619e7330 (patch)
treec770790801b0928ac40306ad98a5100a78ca8c31 /iconv/iconv.h
parent0e12ca024119ec6c6d2ac852a65046002efa0e80 (diff)
downloadglibc-260a430dd841072020c4dae91468322e619e7330.zip
glibc-260a430dd841072020c4dae91468322e619e7330.tar.gz
glibc-260a430dd841072020c4dae91468322e619e7330.tar.bz2
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>
Diffstat (limited to 'iconv/iconv.h')
-rw-r--r--iconv/iconv.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/iconv/iconv.h b/iconv/iconv.h
index aa936a3..544425d 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 */