aboutsummaryrefslogtreecommitdiff
path: root/libio/iofclose.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-01-26 06:55:29 +0000
committerUlrich Drepper <drepper@redhat.com>2000-01-26 06:55:29 +0000
commit4e2e99997a2890df8ab5d7b86646a2b067eb8723 (patch)
tree30c16b2a54b2c166e03f136f4bd99a13db915032 /libio/iofclose.c
parentc36897fb5bef95d586557f960840ee0c614adabf (diff)
downloadglibc-4e2e99997a2890df8ab5d7b86646a2b067eb8723.zip
glibc-4e2e99997a2890df8ab5d7b86646a2b067eb8723.tar.gz
glibc-4e2e99997a2890df8ab5d7b86646a2b067eb8723.tar.bz2
Update.
* libio/fileops.c (_IO_new_file_open): Recognize ,ccs= in mode string and load appropriate conversions. * libio/iofwide.c (__libio_codecvt): Renamed from libio_codecvt and made global. * libio/libioP.h: Declare __libio_codecvt. * manual/stdio.texi: Document ,ccs= option for fopen. * wcsmbs/wcsmbsload.c (__wcsmbs_named_conv): New function. * wcsmbs/wcsmbsload.h (__wcsmbs_named_conv): Declare. * libio/iofclose.c: Free conversion data if stream was wide-oriented. * sysdeps/unix/sysv/linux/i386/Dist: Add sys/io.h.
Diffstat (limited to 'libio/iofclose.c')
-rw-r--r--libio/iofclose.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/libio/iofclose.c b/libio/iofclose.c
index 04503e7..a10ed92 100644
--- a/libio/iofclose.c
+++ b/libio/iofclose.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995, 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1995, 1997-1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This library is free software; you can redistribute it and/or
@@ -27,6 +27,9 @@
#ifdef __STDC__
#include <stdlib.h>
#endif
+#if _LIBC
+# include "../iconv/gconv_int.h"
+#endif
int
_IO_new_fclose (fp)
@@ -52,6 +55,25 @@ _IO_new_fclose (fp)
status = fp->_flags & _IO_ERR_SEEN ? -1 : 0;
_IO_FINISH (fp);
_IO_funlockfile (fp);
+ if (fp->_mode > 0)
+ {
+#if _LIBC
+ /* This stream has a wide orientation. This means we have to free
+ the conversion functions. */
+ struct _IO_codecvt *cc = &fp->_wide_data->_codecvt;
+
+ if (cc->__cd_in.__cd.__steps->__shlib_handle != NULL)
+ {
+ --cc->__cd_in.__cd.__steps->__counter;
+ __gconv_close_transform (cc->__cd_in.__cd.__steps, 1);
+ }
+ if (cc->__cd_out.__cd.__steps->__shlib_handle != NULL)
+ {
+ --cc->__cd_out.__cd.__steps->__counter;
+ __gconv_close_transform (cc->__cd_out.__cd.__steps, 1);
+ }
+#endif
+ }
_IO_cleanup_region_end (0);
if (_IO_have_backup (fp))
_IO_free_backup_area (fp);