glibc/iconv/gconv_cache.c

474 lines
13 KiB
C
Raw Normal View History

/* Cache handling for iconv modules.
Copyright (C) 2001, 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 2001.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <dlfcn.h>
Update. 2003-04-19 Ulrich Drepper <drepper@redhat.com> * catgets/nl_types.h: Remove __THROW marker from cancellation points. * dirent/dirent.h: Likewise. * dlfcn/dlfcn.h: Likewise. * grp/grp.h: Likewise. * iconv/iconv.h: Likewise. * io/fcntl.h: Likewise. * io/ftw.h: Likewise. * libio/stdio.h: Likewise. * misc/sys/mman.h: Likewise. * misc/sys/select.h: Likewise. * misc/sys/syslog.h: Likewise. * misc/sys/uio.h: Likewise. * posix/spawn.h: Likewise. * posix/unistd.h: Likewise. * posix/sys/wait.h: Likewise. * pwd/pwd.h: Likewise. * resolv/netdb.h: Likewise. * rt/aio.h: Likewise. * shadow/shadow.h: Likewise. * signal/signal.h: Likewise. * socket/sys/socket.h: Likewise. * stdlib/stdlib.h: Likewise. * streams/stropts.h: Likewise. * string/string.h: Likewise. * sysdeps/gnu/utmpx.h: Likewise. * sysvipc/sys/msg.h: Likewise. * termios/termios.h: Likewise. * time/time.h: Likewise. * wcsmbs/wchar.h: Likewise. * iconv/gconv_cache.c: Include <not-cancel.h> and use non-cancelable functions. * misc/daemon.c: Likewise. * sysdeps/generic/backtracesymsfd.c: Likewise. * sysdeps/generic/check_fds.c: Likewise. * sysdeps/unix/sysv/linux/gethostid.c: Likewise. * sysdeps/unix/sysv/linux/not-cancel.h: New file. * sysdeps/generic/not-cancel.h: New file. * csu/Makefile (distribute): Add not-cancel.h. * sysdeps/unix/sysv/linux/fatal-prepare.h: New file. * sysdeps/unix/sysv/linux/Makefile: Define FATAL_PREPARE_INCLUDE for assert.c and assert-perr.c to include <fatal-prepare.h>. * sysdeps/unix/sysv/linux/Dist: Add fatal-prepare.h. * sysdeps/posix/remove.c (remove): Rewrite. No need to restore errno and unlink first. * io/ftw.c (ftw_dir): In all places assume fchdir is available. 2003-04-18 Ulrich Drepper <drepper@redhat.com> * sysdeps/unix/sysv/linux/libc_fatal.c (__libc_fatal): Use INTERNAL_SYSCALL instead of INLINE_SYSCALL.
2003-04-19 18:57:17 +02:00
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <gconv_int.h>
#include <iconvconfig.h>
Update. 2003-04-19 Ulrich Drepper <drepper@redhat.com> * catgets/nl_types.h: Remove __THROW marker from cancellation points. * dirent/dirent.h: Likewise. * dlfcn/dlfcn.h: Likewise. * grp/grp.h: Likewise. * iconv/iconv.h: Likewise. * io/fcntl.h: Likewise. * io/ftw.h: Likewise. * libio/stdio.h: Likewise. * misc/sys/mman.h: Likewise. * misc/sys/select.h: Likewise. * misc/sys/syslog.h: Likewise. * misc/sys/uio.h: Likewise. * posix/spawn.h: Likewise. * posix/unistd.h: Likewise. * posix/sys/wait.h: Likewise. * pwd/pwd.h: Likewise. * resolv/netdb.h: Likewise. * rt/aio.h: Likewise. * shadow/shadow.h: Likewise. * signal/signal.h: Likewise. * socket/sys/socket.h: Likewise. * stdlib/stdlib.h: Likewise. * streams/stropts.h: Likewise. * string/string.h: Likewise. * sysdeps/gnu/utmpx.h: Likewise. * sysvipc/sys/msg.h: Likewise. * termios/termios.h: Likewise. * time/time.h: Likewise. * wcsmbs/wchar.h: Likewise. * iconv/gconv_cache.c: Include <not-cancel.h> and use non-cancelable functions. * misc/daemon.c: Likewise. * sysdeps/generic/backtracesymsfd.c: Likewise. * sysdeps/generic/check_fds.c: Likewise. * sysdeps/unix/sysv/linux/gethostid.c: Likewise. * sysdeps/unix/sysv/linux/not-cancel.h: New file. * sysdeps/generic/not-cancel.h: New file. * csu/Makefile (distribute): Add not-cancel.h. * sysdeps/unix/sysv/linux/fatal-prepare.h: New file. * sysdeps/unix/sysv/linux/Makefile: Define FATAL_PREPARE_INCLUDE for assert.c and assert-perr.c to include <fatal-prepare.h>. * sysdeps/unix/sysv/linux/Dist: Add fatal-prepare.h. * sysdeps/posix/remove.c (remove): Rewrite. No need to restore errno and unlink first. * io/ftw.c (ftw_dir): In all places assume fchdir is available. 2003-04-18 Ulrich Drepper <drepper@redhat.com> * sysdeps/unix/sysv/linux/libc_fatal.c (__libc_fatal): Use INTERNAL_SYSCALL instead of INLINE_SYSCALL.
2003-04-19 18:57:17 +02:00
#include <not-cancel.h>
#include "../intl/hash-string.h"
Update. 2002-08-04 Ulrich Drepper <drepper@redhat.com> * stdio-common/psignal.c: Declare _sys_siglist_internal. Use USEINT to access _sys_siglist. * string/strsignal.c: Likewise. * sysdeps/generic/siglist.c: Add _sys_siglist_internal alias. * sysdeps/gnu/siglist.c: Likewise. * sysdeps/unix/siglist.c: Likewise. * sysdeps/unix/sysv/linux/arm/siglist.c: Likewise. * libio/fileops.c: Add missing INTUSEs for _IO_file_jumps. * libio/wfileops.c: Add missing INTUSE for _IO_file_close. * intl/dcigettext.c: Define _nl_default_dirname_internal as hidden alias and use it. * intl/bindtextdom.c: Use _nl_default_dirname_internal. * include/netinet/in.h: Add declaration of in6addr_loopback_internal. * inet/in6_addr.c: Add INTVARDEF for in6addr_loopback. * sysdeps/posix/getaddrinfo.c: Use INTUSE for in6addr_loopback access. * include/time.h: Add libc_hidden_proto for __gmtime_r. * time/gmtime.c (__gmtime_r): Add libc_hidden_def. * iconv/Versions: Replace __gconv_alias_db, __gconv_modules_db, and __gconv_cache with __gconv_get_alias_db, __gconv_get_modules_db, and __gconv_get_cache respectively. * iconv/gconv_cache.c (gconv_cache): Renamed for __gconv_cache and defined static. Change all users. (__gconv_get_cache): New function. * iconv/gconv_db.c (__gconv_get_modules_db): New function. (__gconv_get_alias_db): New function. * iconv/gconv_int.h (__gconv_alias_db): Declare as hidden. (__conv_modules_db): Likewise. Add prototypes for __gconv_get_cache, __gconv_get_modules_db, and __gconv_get_alias_db. * iconv/iconv_prog.c: Use the new functions instead of accessing the variables. * include/stdlib.h: Add prototype and libc_hidden_proto for __default_morecore. * sysdeps/generic/morecore.c: Include <stdlib.h>. * malloc/obstack.c: Remove fputs macro. * malloc/mtrace.c: Remove fopen macro.
2002-08-05 01:32:14 +02:00
static void *gconv_cache;
static size_t cache_size;
static int cache_malloced;
Update. 2002-08-04 Ulrich Drepper <drepper@redhat.com> * stdio-common/psignal.c: Declare _sys_siglist_internal. Use USEINT to access _sys_siglist. * string/strsignal.c: Likewise. * sysdeps/generic/siglist.c: Add _sys_siglist_internal alias. * sysdeps/gnu/siglist.c: Likewise. * sysdeps/unix/siglist.c: Likewise. * sysdeps/unix/sysv/linux/arm/siglist.c: Likewise. * libio/fileops.c: Add missing INTUSEs for _IO_file_jumps. * libio/wfileops.c: Add missing INTUSE for _IO_file_close. * intl/dcigettext.c: Define _nl_default_dirname_internal as hidden alias and use it. * intl/bindtextdom.c: Use _nl_default_dirname_internal. * include/netinet/in.h: Add declaration of in6addr_loopback_internal. * inet/in6_addr.c: Add INTVARDEF for in6addr_loopback. * sysdeps/posix/getaddrinfo.c: Use INTUSE for in6addr_loopback access. * include/time.h: Add libc_hidden_proto for __gmtime_r. * time/gmtime.c (__gmtime_r): Add libc_hidden_def. * iconv/Versions: Replace __gconv_alias_db, __gconv_modules_db, and __gconv_cache with __gconv_get_alias_db, __gconv_get_modules_db, and __gconv_get_cache respectively. * iconv/gconv_cache.c (gconv_cache): Renamed for __gconv_cache and defined static. Change all users. (__gconv_get_cache): New function. * iconv/gconv_db.c (__gconv_get_modules_db): New function. (__gconv_get_alias_db): New function. * iconv/gconv_int.h (__gconv_alias_db): Declare as hidden. (__conv_modules_db): Likewise. Add prototypes for __gconv_get_cache, __gconv_get_modules_db, and __gconv_get_alias_db. * iconv/iconv_prog.c: Use the new functions instead of accessing the variables. * include/stdlib.h: Add prototype and libc_hidden_proto for __default_morecore. * sysdeps/generic/morecore.c: Include <stdlib.h>. * malloc/obstack.c: Remove fputs macro. * malloc/mtrace.c: Remove fopen macro.
2002-08-05 01:32:14 +02:00
void *
__gconv_get_cache (void)
{
return gconv_cache;
}
int
internal_function
__gconv_load_cache (void)
{
int fd;
struct stat64 st;
struct gconvcache_header *header;
/* We cannot use the cache if the GCONV_PATH environment variable is
set. */
__gconv_path_envvar = getenv ("GCONV_PATH");
if (__gconv_path_envvar != NULL)
return -1;
/* See whether the cache file exists. */
fd = open_not_cancel (GCONV_MODULES_CACHE, O_RDONLY, 0);
if (__builtin_expect (fd, 0) == -1)
/* Not available. */
return -1;
/* Get information about the file. */
if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0) < 0
/* We do not have to start looking at the file if it cannot contain
at least the cache header. */
Update. 2002-08-24 Ulrich Drepper <drepper@redhat.com> * locale/programs/charmap.c (charmap_new_char): Don't use ULONG_MAX as maximum UCS4 value. * sysdeps/unix/sysv/linux/ia64/sys/user.h: New file. * sysdeps/generic/strtol.c: We don't need the isascii test in glibc. * malloc/hooks.c (public_sET_STATe): use size_t as type for i. * malloc/malloc.c (mALLINFo): Likewise. * libio/wstrops.c (_IO_wstr_pbackfail): Use WEOF in comparison. * libio/wfileops.c (_IO_wfile_overflow): Use EOF not WEOF when examining result of _IO_do_flush call. * stdio-common/vfprintf.c (vfprintf): Use correct type in va_arg. Use prec not spec when sizing buffers. * catgets/open_catalog.c (__open_catalog): Add casts to avoid warnings. * locale/loadarchive.c (_nl_load_locale_from_archive): Likewise. * locale/loadlocale.c (_nl_intern_locale_data): Likewise. * stdio-common/vfscanf.c (inchar): Likewise. * misc/efgcvt_r.c (fcvt_r): Likewise. * elf/dl-misc.c (_dl_debug_vdprintf): Likewise. * elf/readlib.c (process_file): Likewise. * elf/sprof.c (load_profdata): Likewise. * sysdeps/ia64/hp-timing.h (HP_TIMING_PRINT): Likewise. * locale/programs/linereader.c (get_toplvl_escape): Likewise. * locale/programs/charmap.c (charmap_read): Likewise. * libio/fileops.c: Likewise. * libio/fmemopen.c: Likewise. * stdlib/strtod.c: Likewise. * elf/dl-load.c: Likewise. * iconv/iconvconfig.c: Likewise. * iconv/iconv_prog.c (process_block): Likewise. * sysdeps/unix/sysv/linux/ia64/Makefile: Define _ASM_IA64_CURRENT_H macro to calm down the compiler. * iconv/gconv_cache.c (__gconv_load_cache): Add cast to avoid warning. * sysdeps/ia64/elf/initfini.c: Don't use newlines embedded in string. * sysdeps/unix/sysv/linux/i386/sysdep.S: Update comment regarding placement of errno definition. * sysdeps/unix/sysv/linux/m68k/sysdep.S: Likewise. * sysdeps/unix/sysv/linux/mips/sysdep.S: Likewise. * sysdeps/unix/sysv/linux/x86_64/sysdep.S: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/sysdep.S: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep.S: Likewise. * resolv/nss_dns/dns-host.c (MAXPACKET): Increase minimum value from 1024 to 65536, to avoid buffer overrun. 2002-08-16 Paul Eggert <eggert@twinsun.com> * resolv/gethnamaddr.c (MAXPACKET): Increase minimum value from 1024 to 65536, to avoid buffer overrun. * resolv/res_query.c (MAXPACKET): Likewise. architectures.
2002-08-25 06:51:08 +02:00
|| (size_t) st.st_size < sizeof (struct gconvcache_header))
{
close_and_exit:
Update. 2003-04-19 Ulrich Drepper <drepper@redhat.com> * catgets/nl_types.h: Remove __THROW marker from cancellation points. * dirent/dirent.h: Likewise. * dlfcn/dlfcn.h: Likewise. * grp/grp.h: Likewise. * iconv/iconv.h: Likewise. * io/fcntl.h: Likewise. * io/ftw.h: Likewise. * libio/stdio.h: Likewise. * misc/sys/mman.h: Likewise. * misc/sys/select.h: Likewise. * misc/sys/syslog.h: Likewise. * misc/sys/uio.h: Likewise. * posix/spawn.h: Likewise. * posix/unistd.h: Likewise. * posix/sys/wait.h: Likewise. * pwd/pwd.h: Likewise. * resolv/netdb.h: Likewise. * rt/aio.h: Likewise. * shadow/shadow.h: Likewise. * signal/signal.h: Likewise. * socket/sys/socket.h: Likewise. * stdlib/stdlib.h: Likewise. * streams/stropts.h: Likewise. * string/string.h: Likewise. * sysdeps/gnu/utmpx.h: Likewise. * sysvipc/sys/msg.h: Likewise. * termios/termios.h: Likewise. * time/time.h: Likewise. * wcsmbs/wchar.h: Likewise. * iconv/gconv_cache.c: Include <not-cancel.h> and use non-cancelable functions. * misc/daemon.c: Likewise. * sysdeps/generic/backtracesymsfd.c: Likewise. * sysdeps/generic/check_fds.c: Likewise. * sysdeps/unix/sysv/linux/gethostid.c: Likewise. * sysdeps/unix/sysv/linux/not-cancel.h: New file. * sysdeps/generic/not-cancel.h: New file. * csu/Makefile (distribute): Add not-cancel.h. * sysdeps/unix/sysv/linux/fatal-prepare.h: New file. * sysdeps/unix/sysv/linux/Makefile: Define FATAL_PREPARE_INCLUDE for assert.c and assert-perr.c to include <fatal-prepare.h>. * sysdeps/unix/sysv/linux/Dist: Add fatal-prepare.h. * sysdeps/posix/remove.c (remove): Rewrite. No need to restore errno and unlink first. * io/ftw.c (ftw_dir): In all places assume fchdir is available. 2003-04-18 Ulrich Drepper <drepper@redhat.com> * sysdeps/unix/sysv/linux/libc_fatal.c (__libc_fatal): Use INTERNAL_SYSCALL instead of INLINE_SYSCALL.
2003-04-19 18:57:17 +02:00
close_not_cancel_no_status (fd);
return -1;
}
/* Make the file content available. */
cache_size = st.st_size;
#ifdef _POSIX_MAPPED_FILES
Update. 2002-08-04 Ulrich Drepper <drepper@redhat.com> * stdio-common/psignal.c: Declare _sys_siglist_internal. Use USEINT to access _sys_siglist. * string/strsignal.c: Likewise. * sysdeps/generic/siglist.c: Add _sys_siglist_internal alias. * sysdeps/gnu/siglist.c: Likewise. * sysdeps/unix/siglist.c: Likewise. * sysdeps/unix/sysv/linux/arm/siglist.c: Likewise. * libio/fileops.c: Add missing INTUSEs for _IO_file_jumps. * libio/wfileops.c: Add missing INTUSE for _IO_file_close. * intl/dcigettext.c: Define _nl_default_dirname_internal as hidden alias and use it. * intl/bindtextdom.c: Use _nl_default_dirname_internal. * include/netinet/in.h: Add declaration of in6addr_loopback_internal. * inet/in6_addr.c: Add INTVARDEF for in6addr_loopback. * sysdeps/posix/getaddrinfo.c: Use INTUSE for in6addr_loopback access. * include/time.h: Add libc_hidden_proto for __gmtime_r. * time/gmtime.c (__gmtime_r): Add libc_hidden_def. * iconv/Versions: Replace __gconv_alias_db, __gconv_modules_db, and __gconv_cache with __gconv_get_alias_db, __gconv_get_modules_db, and __gconv_get_cache respectively. * iconv/gconv_cache.c (gconv_cache): Renamed for __gconv_cache and defined static. Change all users. (__gconv_get_cache): New function. * iconv/gconv_db.c (__gconv_get_modules_db): New function. (__gconv_get_alias_db): New function. * iconv/gconv_int.h (__gconv_alias_db): Declare as hidden. (__conv_modules_db): Likewise. Add prototypes for __gconv_get_cache, __gconv_get_modules_db, and __gconv_get_alias_db. * iconv/iconv_prog.c: Use the new functions instead of accessing the variables. * include/stdlib.h: Add prototype and libc_hidden_proto for __default_morecore. * sysdeps/generic/morecore.c: Include <stdlib.h>. * malloc/obstack.c: Remove fputs macro. * malloc/mtrace.c: Remove fopen macro.
2002-08-05 01:32:14 +02:00
gconv_cache = __mmap (NULL, cache_size, PROT_READ, MAP_SHARED, fd, 0);
if (__builtin_expect (gconv_cache == MAP_FAILED, 0))
#endif
{
size_t already_read;
Update. 2002-08-04 Ulrich Drepper <drepper@redhat.com> * stdio-common/psignal.c: Declare _sys_siglist_internal. Use USEINT to access _sys_siglist. * string/strsignal.c: Likewise. * sysdeps/generic/siglist.c: Add _sys_siglist_internal alias. * sysdeps/gnu/siglist.c: Likewise. * sysdeps/unix/siglist.c: Likewise. * sysdeps/unix/sysv/linux/arm/siglist.c: Likewise. * libio/fileops.c: Add missing INTUSEs for _IO_file_jumps. * libio/wfileops.c: Add missing INTUSE for _IO_file_close. * intl/dcigettext.c: Define _nl_default_dirname_internal as hidden alias and use it. * intl/bindtextdom.c: Use _nl_default_dirname_internal. * include/netinet/in.h: Add declaration of in6addr_loopback_internal. * inet/in6_addr.c: Add INTVARDEF for in6addr_loopback. * sysdeps/posix/getaddrinfo.c: Use INTUSE for in6addr_loopback access. * include/time.h: Add libc_hidden_proto for __gmtime_r. * time/gmtime.c (__gmtime_r): Add libc_hidden_def. * iconv/Versions: Replace __gconv_alias_db, __gconv_modules_db, and __gconv_cache with __gconv_get_alias_db, __gconv_get_modules_db, and __gconv_get_cache respectively. * iconv/gconv_cache.c (gconv_cache): Renamed for __gconv_cache and defined static. Change all users. (__gconv_get_cache): New function. * iconv/gconv_db.c (__gconv_get_modules_db): New function. (__gconv_get_alias_db): New function. * iconv/gconv_int.h (__gconv_alias_db): Declare as hidden. (__conv_modules_db): Likewise. Add prototypes for __gconv_get_cache, __gconv_get_modules_db, and __gconv_get_alias_db. * iconv/iconv_prog.c: Use the new functions instead of accessing the variables. * include/stdlib.h: Add prototype and libc_hidden_proto for __default_morecore. * sysdeps/generic/morecore.c: Include <stdlib.h>. * malloc/obstack.c: Remove fputs macro. * malloc/mtrace.c: Remove fopen macro.
2002-08-05 01:32:14 +02:00
gconv_cache = malloc (cache_size);
if (gconv_cache == NULL)
goto close_and_exit;
already_read = 0;
do
{
Update. 2002-08-04 Ulrich Drepper <drepper@redhat.com> * stdio-common/psignal.c: Declare _sys_siglist_internal. Use USEINT to access _sys_siglist. * string/strsignal.c: Likewise. * sysdeps/generic/siglist.c: Add _sys_siglist_internal alias. * sysdeps/gnu/siglist.c: Likewise. * sysdeps/unix/siglist.c: Likewise. * sysdeps/unix/sysv/linux/arm/siglist.c: Likewise. * libio/fileops.c: Add missing INTUSEs for _IO_file_jumps. * libio/wfileops.c: Add missing INTUSE for _IO_file_close. * intl/dcigettext.c: Define _nl_default_dirname_internal as hidden alias and use it. * intl/bindtextdom.c: Use _nl_default_dirname_internal. * include/netinet/in.h: Add declaration of in6addr_loopback_internal. * inet/in6_addr.c: Add INTVARDEF for in6addr_loopback. * sysdeps/posix/getaddrinfo.c: Use INTUSE for in6addr_loopback access. * include/time.h: Add libc_hidden_proto for __gmtime_r. * time/gmtime.c (__gmtime_r): Add libc_hidden_def. * iconv/Versions: Replace __gconv_alias_db, __gconv_modules_db, and __gconv_cache with __gconv_get_alias_db, __gconv_get_modules_db, and __gconv_get_cache respectively. * iconv/gconv_cache.c (gconv_cache): Renamed for __gconv_cache and defined static. Change all users. (__gconv_get_cache): New function. * iconv/gconv_db.c (__gconv_get_modules_db): New function. (__gconv_get_alias_db): New function. * iconv/gconv_int.h (__gconv_alias_db): Declare as hidden. (__conv_modules_db): Likewise. Add prototypes for __gconv_get_cache, __gconv_get_modules_db, and __gconv_get_alias_db. * iconv/iconv_prog.c: Use the new functions instead of accessing the variables. * include/stdlib.h: Add prototype and libc_hidden_proto for __default_morecore. * sysdeps/generic/morecore.c: Include <stdlib.h>. * malloc/obstack.c: Remove fputs macro. * malloc/mtrace.c: Remove fopen macro.
2002-08-05 01:32:14 +02:00
ssize_t n = __read (fd, (char *) gconv_cache + already_read,
cache_size - already_read);
if (__builtin_expect (n, 0) == -1)
{
Update. 2002-08-04 Ulrich Drepper <drepper@redhat.com> * stdio-common/psignal.c: Declare _sys_siglist_internal. Use USEINT to access _sys_siglist. * string/strsignal.c: Likewise. * sysdeps/generic/siglist.c: Add _sys_siglist_internal alias. * sysdeps/gnu/siglist.c: Likewise. * sysdeps/unix/siglist.c: Likewise. * sysdeps/unix/sysv/linux/arm/siglist.c: Likewise. * libio/fileops.c: Add missing INTUSEs for _IO_file_jumps. * libio/wfileops.c: Add missing INTUSE for _IO_file_close. * intl/dcigettext.c: Define _nl_default_dirname_internal as hidden alias and use it. * intl/bindtextdom.c: Use _nl_default_dirname_internal. * include/netinet/in.h: Add declaration of in6addr_loopback_internal. * inet/in6_addr.c: Add INTVARDEF for in6addr_loopback. * sysdeps/posix/getaddrinfo.c: Use INTUSE for in6addr_loopback access. * include/time.h: Add libc_hidden_proto for __gmtime_r. * time/gmtime.c (__gmtime_r): Add libc_hidden_def. * iconv/Versions: Replace __gconv_alias_db, __gconv_modules_db, and __gconv_cache with __gconv_get_alias_db, __gconv_get_modules_db, and __gconv_get_cache respectively. * iconv/gconv_cache.c (gconv_cache): Renamed for __gconv_cache and defined static. Change all users. (__gconv_get_cache): New function. * iconv/gconv_db.c (__gconv_get_modules_db): New function. (__gconv_get_alias_db): New function. * iconv/gconv_int.h (__gconv_alias_db): Declare as hidden. (__conv_modules_db): Likewise. Add prototypes for __gconv_get_cache, __gconv_get_modules_db, and __gconv_get_alias_db. * iconv/iconv_prog.c: Use the new functions instead of accessing the variables. * include/stdlib.h: Add prototype and libc_hidden_proto for __default_morecore. * sysdeps/generic/morecore.c: Include <stdlib.h>. * malloc/obstack.c: Remove fputs macro. * malloc/mtrace.c: Remove fopen macro.
2002-08-05 01:32:14 +02:00
free (gconv_cache);
gconv_cache = NULL;
goto close_and_exit;
}
already_read += n;
}
while (already_read < cache_size);
cache_malloced = 1;
}
/* We don't need the file descriptor anymore. */
Update. 2003-04-19 Ulrich Drepper <drepper@redhat.com> * catgets/nl_types.h: Remove __THROW marker from cancellation points. * dirent/dirent.h: Likewise. * dlfcn/dlfcn.h: Likewise. * grp/grp.h: Likewise. * iconv/iconv.h: Likewise. * io/fcntl.h: Likewise. * io/ftw.h: Likewise. * libio/stdio.h: Likewise. * misc/sys/mman.h: Likewise. * misc/sys/select.h: Likewise. * misc/sys/syslog.h: Likewise. * misc/sys/uio.h: Likewise. * posix/spawn.h: Likewise. * posix/unistd.h: Likewise. * posix/sys/wait.h: Likewise. * pwd/pwd.h: Likewise. * resolv/netdb.h: Likewise. * rt/aio.h: Likewise. * shadow/shadow.h: Likewise. * signal/signal.h: Likewise. * socket/sys/socket.h: Likewise. * stdlib/stdlib.h: Likewise. * streams/stropts.h: Likewise. * string/string.h: Likewise. * sysdeps/gnu/utmpx.h: Likewise. * sysvipc/sys/msg.h: Likewise. * termios/termios.h: Likewise. * time/time.h: Likewise. * wcsmbs/wchar.h: Likewise. * iconv/gconv_cache.c: Include <not-cancel.h> and use non-cancelable functions. * misc/daemon.c: Likewise. * sysdeps/generic/backtracesymsfd.c: Likewise. * sysdeps/generic/check_fds.c: Likewise. * sysdeps/unix/sysv/linux/gethostid.c: Likewise. * sysdeps/unix/sysv/linux/not-cancel.h: New file. * sysdeps/generic/not-cancel.h: New file. * csu/Makefile (distribute): Add not-cancel.h. * sysdeps/unix/sysv/linux/fatal-prepare.h: New file. * sysdeps/unix/sysv/linux/Makefile: Define FATAL_PREPARE_INCLUDE for assert.c and assert-perr.c to include <fatal-prepare.h>. * sysdeps/unix/sysv/linux/Dist: Add fatal-prepare.h. * sysdeps/posix/remove.c (remove): Rewrite. No need to restore errno and unlink first. * io/ftw.c (ftw_dir): In all places assume fchdir is available. 2003-04-18 Ulrich Drepper <drepper@redhat.com> * sysdeps/unix/sysv/linux/libc_fatal.c (__libc_fatal): Use INTERNAL_SYSCALL instead of INLINE_SYSCALL.
2003-04-19 18:57:17 +02:00
close_not_cancel_no_status (fd);
/* Check the consistency. */
Update. 2002-08-04 Ulrich Drepper <drepper@redhat.com> * stdio-common/psignal.c: Declare _sys_siglist_internal. Use USEINT to access _sys_siglist. * string/strsignal.c: Likewise. * sysdeps/generic/siglist.c: Add _sys_siglist_internal alias. * sysdeps/gnu/siglist.c: Likewise. * sysdeps/unix/siglist.c: Likewise. * sysdeps/unix/sysv/linux/arm/siglist.c: Likewise. * libio/fileops.c: Add missing INTUSEs for _IO_file_jumps. * libio/wfileops.c: Add missing INTUSE for _IO_file_close. * intl/dcigettext.c: Define _nl_default_dirname_internal as hidden alias and use it. * intl/bindtextdom.c: Use _nl_default_dirname_internal. * include/netinet/in.h: Add declaration of in6addr_loopback_internal. * inet/in6_addr.c: Add INTVARDEF for in6addr_loopback. * sysdeps/posix/getaddrinfo.c: Use INTUSE for in6addr_loopback access. * include/time.h: Add libc_hidden_proto for __gmtime_r. * time/gmtime.c (__gmtime_r): Add libc_hidden_def. * iconv/Versions: Replace __gconv_alias_db, __gconv_modules_db, and __gconv_cache with __gconv_get_alias_db, __gconv_get_modules_db, and __gconv_get_cache respectively. * iconv/gconv_cache.c (gconv_cache): Renamed for __gconv_cache and defined static. Change all users. (__gconv_get_cache): New function. * iconv/gconv_db.c (__gconv_get_modules_db): New function. (__gconv_get_alias_db): New function. * iconv/gconv_int.h (__gconv_alias_db): Declare as hidden. (__conv_modules_db): Likewise. Add prototypes for __gconv_get_cache, __gconv_get_modules_db, and __gconv_get_alias_db. * iconv/iconv_prog.c: Use the new functions instead of accessing the variables. * include/stdlib.h: Add prototype and libc_hidden_proto for __default_morecore. * sysdeps/generic/morecore.c: Include <stdlib.h>. * malloc/obstack.c: Remove fputs macro. * malloc/mtrace.c: Remove fopen macro.
2002-08-05 01:32:14 +02:00
header = (struct gconvcache_header *) gconv_cache;
if (__builtin_expect (header->magic, GCONVCACHE_MAGIC) != GCONVCACHE_MAGIC
|| __builtin_expect (header->string_offset >= cache_size, 0)
|| __builtin_expect (header->hash_offset >= cache_size, 0)
|| __builtin_expect (header->hash_size == 0, 0)
|| __builtin_expect ((header->hash_offset
+ header->hash_size * sizeof (struct hash_entry))
> cache_size, 0)
|| __builtin_expect (header->module_offset >= cache_size, 0)
|| __builtin_expect (header->otherconv_offset > cache_size, 0))
{
if (cache_malloced)
{
Update. 2002-08-04 Ulrich Drepper <drepper@redhat.com> * stdio-common/psignal.c: Declare _sys_siglist_internal. Use USEINT to access _sys_siglist. * string/strsignal.c: Likewise. * sysdeps/generic/siglist.c: Add _sys_siglist_internal alias. * sysdeps/gnu/siglist.c: Likewise. * sysdeps/unix/siglist.c: Likewise. * sysdeps/unix/sysv/linux/arm/siglist.c: Likewise. * libio/fileops.c: Add missing INTUSEs for _IO_file_jumps. * libio/wfileops.c: Add missing INTUSE for _IO_file_close. * intl/dcigettext.c: Define _nl_default_dirname_internal as hidden alias and use it. * intl/bindtextdom.c: Use _nl_default_dirname_internal. * include/netinet/in.h: Add declaration of in6addr_loopback_internal. * inet/in6_addr.c: Add INTVARDEF for in6addr_loopback. * sysdeps/posix/getaddrinfo.c: Use INTUSE for in6addr_loopback access. * include/time.h: Add libc_hidden_proto for __gmtime_r. * time/gmtime.c (__gmtime_r): Add libc_hidden_def. * iconv/Versions: Replace __gconv_alias_db, __gconv_modules_db, and __gconv_cache with __gconv_get_alias_db, __gconv_get_modules_db, and __gconv_get_cache respectively. * iconv/gconv_cache.c (gconv_cache): Renamed for __gconv_cache and defined static. Change all users. (__gconv_get_cache): New function. * iconv/gconv_db.c (__gconv_get_modules_db): New function. (__gconv_get_alias_db): New function. * iconv/gconv_int.h (__gconv_alias_db): Declare as hidden. (__conv_modules_db): Likewise. Add prototypes for __gconv_get_cache, __gconv_get_modules_db, and __gconv_get_alias_db. * iconv/iconv_prog.c: Use the new functions instead of accessing the variables. * include/stdlib.h: Add prototype and libc_hidden_proto for __default_morecore. * sysdeps/generic/morecore.c: Include <stdlib.h>. * malloc/obstack.c: Remove fputs macro. * malloc/mtrace.c: Remove fopen macro.
2002-08-05 01:32:14 +02:00
free (gconv_cache);
cache_malloced = 0;
}
#ifdef _POSIX_MAPPED_FILES
else
Update. 2002-08-04 Ulrich Drepper <drepper@redhat.com> * stdio-common/psignal.c: Declare _sys_siglist_internal. Use USEINT to access _sys_siglist. * string/strsignal.c: Likewise. * sysdeps/generic/siglist.c: Add _sys_siglist_internal alias. * sysdeps/gnu/siglist.c: Likewise. * sysdeps/unix/siglist.c: Likewise. * sysdeps/unix/sysv/linux/arm/siglist.c: Likewise. * libio/fileops.c: Add missing INTUSEs for _IO_file_jumps. * libio/wfileops.c: Add missing INTUSE for _IO_file_close. * intl/dcigettext.c: Define _nl_default_dirname_internal as hidden alias and use it. * intl/bindtextdom.c: Use _nl_default_dirname_internal. * include/netinet/in.h: Add declaration of in6addr_loopback_internal. * inet/in6_addr.c: Add INTVARDEF for in6addr_loopback. * sysdeps/posix/getaddrinfo.c: Use INTUSE for in6addr_loopback access. * include/time.h: Add libc_hidden_proto for __gmtime_r. * time/gmtime.c (__gmtime_r): Add libc_hidden_def. * iconv/Versions: Replace __gconv_alias_db, __gconv_modules_db, and __gconv_cache with __gconv_get_alias_db, __gconv_get_modules_db, and __gconv_get_cache respectively. * iconv/gconv_cache.c (gconv_cache): Renamed for __gconv_cache and defined static. Change all users. (__gconv_get_cache): New function. * iconv/gconv_db.c (__gconv_get_modules_db): New function. (__gconv_get_alias_db): New function. * iconv/gconv_int.h (__gconv_alias_db): Declare as hidden. (__conv_modules_db): Likewise. Add prototypes for __gconv_get_cache, __gconv_get_modules_db, and __gconv_get_alias_db. * iconv/iconv_prog.c: Use the new functions instead of accessing the variables. * include/stdlib.h: Add prototype and libc_hidden_proto for __default_morecore. * sysdeps/generic/morecore.c: Include <stdlib.h>. * malloc/obstack.c: Remove fputs macro. * malloc/mtrace.c: Remove fopen macro.
2002-08-05 01:32:14 +02:00
__munmap (gconv_cache, cache_size);
#endif
Update. 2002-08-04 Ulrich Drepper <drepper@redhat.com> * stdio-common/psignal.c: Declare _sys_siglist_internal. Use USEINT to access _sys_siglist. * string/strsignal.c: Likewise. * sysdeps/generic/siglist.c: Add _sys_siglist_internal alias. * sysdeps/gnu/siglist.c: Likewise. * sysdeps/unix/siglist.c: Likewise. * sysdeps/unix/sysv/linux/arm/siglist.c: Likewise. * libio/fileops.c: Add missing INTUSEs for _IO_file_jumps. * libio/wfileops.c: Add missing INTUSE for _IO_file_close. * intl/dcigettext.c: Define _nl_default_dirname_internal as hidden alias and use it. * intl/bindtextdom.c: Use _nl_default_dirname_internal. * include/netinet/in.h: Add declaration of in6addr_loopback_internal. * inet/in6_addr.c: Add INTVARDEF for in6addr_loopback. * sysdeps/posix/getaddrinfo.c: Use INTUSE for in6addr_loopback access. * include/time.h: Add libc_hidden_proto for __gmtime_r. * time/gmtime.c (__gmtime_r): Add libc_hidden_def. * iconv/Versions: Replace __gconv_alias_db, __gconv_modules_db, and __gconv_cache with __gconv_get_alias_db, __gconv_get_modules_db, and __gconv_get_cache respectively. * iconv/gconv_cache.c (gconv_cache): Renamed for __gconv_cache and defined static. Change all users. (__gconv_get_cache): New function. * iconv/gconv_db.c (__gconv_get_modules_db): New function. (__gconv_get_alias_db): New function. * iconv/gconv_int.h (__gconv_alias_db): Declare as hidden. (__conv_modules_db): Likewise. Add prototypes for __gconv_get_cache, __gconv_get_modules_db, and __gconv_get_alias_db. * iconv/iconv_prog.c: Use the new functions instead of accessing the variables. * include/stdlib.h: Add prototype and libc_hidden_proto for __default_morecore. * sysdeps/generic/morecore.c: Include <stdlib.h>. * malloc/obstack.c: Remove fputs macro. * malloc/mtrace.c: Remove fopen macro.
2002-08-05 01:32:14 +02:00
gconv_cache = NULL;
return -1;
}
/* That worked. */
return 0;
}
static int
internal_function
find_module_idx (const char *str, size_t *idxp)
{
unsigned int idx;
unsigned int hval;
unsigned int hval2;
const struct gconvcache_header *header;
const char *strtab;
const struct hash_entry *hashtab;
unsigned int limit;
Update. 2002-08-04 Ulrich Drepper <drepper@redhat.com> * stdio-common/psignal.c: Declare _sys_siglist_internal. Use USEINT to access _sys_siglist. * string/strsignal.c: Likewise. * sysdeps/generic/siglist.c: Add _sys_siglist_internal alias. * sysdeps/gnu/siglist.c: Likewise. * sysdeps/unix/siglist.c: Likewise. * sysdeps/unix/sysv/linux/arm/siglist.c: Likewise. * libio/fileops.c: Add missing INTUSEs for _IO_file_jumps. * libio/wfileops.c: Add missing INTUSE for _IO_file_close. * intl/dcigettext.c: Define _nl_default_dirname_internal as hidden alias and use it. * intl/bindtextdom.c: Use _nl_default_dirname_internal. * include/netinet/in.h: Add declaration of in6addr_loopback_internal. * inet/in6_addr.c: Add INTVARDEF for in6addr_loopback. * sysdeps/posix/getaddrinfo.c: Use INTUSE for in6addr_loopback access. * include/time.h: Add libc_hidden_proto for __gmtime_r. * time/gmtime.c (__gmtime_r): Add libc_hidden_def. * iconv/Versions: Replace __gconv_alias_db, __gconv_modules_db, and __gconv_cache with __gconv_get_alias_db, __gconv_get_modules_db, and __gconv_get_cache respectively. * iconv/gconv_cache.c (gconv_cache): Renamed for __gconv_cache and defined static. Change all users. (__gconv_get_cache): New function. * iconv/gconv_db.c (__gconv_get_modules_db): New function. (__gconv_get_alias_db): New function. * iconv/gconv_int.h (__gconv_alias_db): Declare as hidden. (__conv_modules_db): Likewise. Add prototypes for __gconv_get_cache, __gconv_get_modules_db, and __gconv_get_alias_db. * iconv/iconv_prog.c: Use the new functions instead of accessing the variables. * include/stdlib.h: Add prototype and libc_hidden_proto for __default_morecore. * sysdeps/generic/morecore.c: Include <stdlib.h>. * malloc/obstack.c: Remove fputs macro. * malloc/mtrace.c: Remove fopen macro.
2002-08-05 01:32:14 +02:00
header = (const struct gconvcache_header *) gconv_cache;
strtab = (char *) gconv_cache + header->string_offset;
hashtab = (struct hash_entry *) ((char *) gconv_cache
+ header->hash_offset);
hval = __hash_string (str);
idx = hval % header->hash_size;
hval2 = 1 + hval % (header->hash_size - 2);
limit = cache_size - header->string_offset;
while (hashtab[idx].string_offset != 0)
if (hashtab[idx].string_offset < limit
&& strcmp (str, strtab + hashtab[idx].string_offset) == 0)
{
*idxp = hashtab[idx].module_idx;
return 0;
}
else
if ((idx += hval2) >= header->hash_size)
idx -= header->hash_size;
/* Nothing found. */
return -1;
}
#ifndef STATIC_GCONV
static int
internal_function
find_module (const char *directory, const char *filename,
struct __gconv_step *result)
{
size_t dirlen = strlen (directory);
size_t fnamelen = strlen (filename) + 1;
char fullname[dirlen + fnamelen];
int status = __GCONV_NOCONV;
memcpy (__mempcpy (fullname, directory, dirlen), filename, fnamelen);
result->__shlib_handle = __gconv_find_shlib (fullname);
if (result->__shlib_handle != NULL)
{
status = __GCONV_OK;
result->__modname = NULL;
result->__fct = result->__shlib_handle->fct;
result->__init_fct = result->__shlib_handle->init_fct;
result->__end_fct = result->__shlib_handle->end_fct;
Update. 2002-11-30 Bruno Haible <bruno@clisp.org> * iconv/gconv.h (__gconv_btowc_fct): New typedef. (struct __gconv_step): New field __btowc_fct. * wcsmbs/btowc.c (__btowc): Use the __btowc_fct shortcut if possible. * iconv/gconv_int.h (__BUILTIN_TRANSFORM): Renamed from __BUILTIN_TRANS. (__gconv_btwoc_ascii): New declaration. * iconv/gconv_simple.c (BUILTIN_TRANSFORMATION): Add BtowcFct argument. (__gconv_btwoc_ascii): New function. * iconv/gconv_builtin.h: Add BtowcFct argument to all BUILTIN_TRANSFORMATION invocations. * iconv/gconv_conf.c (BUILTIN_TRANSFORMATION): Add BtowcFct argument. * iconv/iconvconfig.c (BUILTIN_TRANSFORMATION): Likewise. * iconv/gconv_builtin.c (map): New field btowc_fct. (BUILTIN_TRANSFORMATION): Add BtowcFct argument. Use it to initialize btowc_fct field. (__gconv_get_builtin_trans): Initialize __btowc_fct field. * iconv/gconv_cache.c (find_module): Initialize __btowc_fct field. * iconv/gconv_db.c (gen_steps, increment_counter): Likewise. * wcsmbs/wcsmbsload.c (to_wc, to_mb): Likewise. * iconv/skeleton.c: Document STORE_REST and FROM_ONEBYTE. (gconv_init): Initialize __btowc_fct field. Undefine EXTRA_LOOP_ARGS and FROM_ONEBYTE at the end. * iconv/loop.c: Document ONEBYTE_BODY. (gconv_btowc, FROM_ONEBYTE): Define if ONEBYTE_BODY is defined. Undefine ONEBYTE_BODY at the end. * iconvdata/8bit-generic.c (ONEBYTE_BODY): New macro. * iconvdata/8bit-gap.c (NONNUL): New macro. (BODY for FROM_LOOP): Use it. (ONEBYTE_BODY): New macro. * iconvdata/isiri-3342.c (HAS_HOLES): Set to 1. (NONNUL): New macro. * iconvdata/ansi_x3.110.c (ONEBYTE_BODY): New macro. * iconvdata/armscii-8.c (ONEBYTE_BODY): New macro. * iconvdata/cp1255.c (ONEBYTE_BODY): New macro. * iconvdata/cp1258.c (ONEBYTE_BODY): New macro. * iconvdata/tcvn5712-1.c (ONEBYTE_BODY): New macro. * iconvdata/big5.c (ONEBYTE_BODY): New macro. * iconvdata/big5hkscs.c (ONEBYTE_BODY): New macro. * iconvdata/euc-cn.c (ONEBYTE_BODY): New macro. * iconvdata/euc-jp.c (ONEBYTE_BODY): New macro. * iconvdata/euc-jisx0213.c (ONEBYTE_BODY): New macro. * iconvdata/euc-kr.c (ONEBYTE_BODY): New macro. * iconvdata/euc-tw.c (ONEBYTE_BODY): New macro. * iconvdata/gbk.c (ONEBYTE_BODY): New macro. * iconvdata/gb18030.c (ONEBYTE_BODY): New macro. * iconvdata/ibm932.c: Include <stdbool.h>. (TRUE, FALSE): Remove macros. (BODY for FROM_LOOP): Remove unused variable rp1. (ONEBYTE_BODY): New macro. (BODY for TO_LOOP): Use bool. * iconvdata/ibm932.h (__ibm932sb_to_ucs4_idx): Remove array. * iconvdata/ibm943.c: Include <stdbool.h>. (TRUE, FALSE): Remove macros. (BODY for FROM_LOOP): Remove unused variable rp1. (ONEBYTE_BODY): New macro. (BODY for TO_LOOP): Use bool. * iconvdata/ibm943.h (__ibm943sb_to_ucs4_idx): Remove array. * iconvdata/iso8859-1.c (ONEBYTE_BODY): New macro. * iconvdata/iso_6937-2.c (ONEBYTE_BODY): New macro. * iconvdata/iso_6937.c (ONEBYTE_BODY): New macro. * iconvdata/johab.c (ONEBYTE_BODY): New macro. * iconvdata/sjis.c (ONEBYTE_BODY): New macro. * iconvdata/shift_jisx0213.c (ONEBYTE_BODY): New macro. * iconvdata/t.61.c (ONEBYTE_BODY): New macro. * iconvdata/uhc.c (ONEBYTE_BODY): New macro. * iconvdata/gbbig5.c: Tweak comment.
2002-12-02 23:39:58 +01:00
/* These settings can be overridden by the init function. */
result->__btowc_fct = NULL;
result->__data = NULL;
Update. 2002-11-30 Bruno Haible <bruno@clisp.org> * iconv/gconv.h (__gconv_btowc_fct): New typedef. (struct __gconv_step): New field __btowc_fct. * wcsmbs/btowc.c (__btowc): Use the __btowc_fct shortcut if possible. * iconv/gconv_int.h (__BUILTIN_TRANSFORM): Renamed from __BUILTIN_TRANS. (__gconv_btwoc_ascii): New declaration. * iconv/gconv_simple.c (BUILTIN_TRANSFORMATION): Add BtowcFct argument. (__gconv_btwoc_ascii): New function. * iconv/gconv_builtin.h: Add BtowcFct argument to all BUILTIN_TRANSFORMATION invocations. * iconv/gconv_conf.c (BUILTIN_TRANSFORMATION): Add BtowcFct argument. * iconv/iconvconfig.c (BUILTIN_TRANSFORMATION): Likewise. * iconv/gconv_builtin.c (map): New field btowc_fct. (BUILTIN_TRANSFORMATION): Add BtowcFct argument. Use it to initialize btowc_fct field. (__gconv_get_builtin_trans): Initialize __btowc_fct field. * iconv/gconv_cache.c (find_module): Initialize __btowc_fct field. * iconv/gconv_db.c (gen_steps, increment_counter): Likewise. * wcsmbs/wcsmbsload.c (to_wc, to_mb): Likewise. * iconv/skeleton.c: Document STORE_REST and FROM_ONEBYTE. (gconv_init): Initialize __btowc_fct field. Undefine EXTRA_LOOP_ARGS and FROM_ONEBYTE at the end. * iconv/loop.c: Document ONEBYTE_BODY. (gconv_btowc, FROM_ONEBYTE): Define if ONEBYTE_BODY is defined. Undefine ONEBYTE_BODY at the end. * iconvdata/8bit-generic.c (ONEBYTE_BODY): New macro. * iconvdata/8bit-gap.c (NONNUL): New macro. (BODY for FROM_LOOP): Use it. (ONEBYTE_BODY): New macro. * iconvdata/isiri-3342.c (HAS_HOLES): Set to 1. (NONNUL): New macro. * iconvdata/ansi_x3.110.c (ONEBYTE_BODY): New macro. * iconvdata/armscii-8.c (ONEBYTE_BODY): New macro. * iconvdata/cp1255.c (ONEBYTE_BODY): New macro. * iconvdata/cp1258.c (ONEBYTE_BODY): New macro. * iconvdata/tcvn5712-1.c (ONEBYTE_BODY): New macro. * iconvdata/big5.c (ONEBYTE_BODY): New macro. * iconvdata/big5hkscs.c (ONEBYTE_BODY): New macro. * iconvdata/euc-cn.c (ONEBYTE_BODY): New macro. * iconvdata/euc-jp.c (ONEBYTE_BODY): New macro. * iconvdata/euc-jisx0213.c (ONEBYTE_BODY): New macro. * iconvdata/euc-kr.c (ONEBYTE_BODY): New macro. * iconvdata/euc-tw.c (ONEBYTE_BODY): New macro. * iconvdata/gbk.c (ONEBYTE_BODY): New macro. * iconvdata/gb18030.c (ONEBYTE_BODY): New macro. * iconvdata/ibm932.c: Include <stdbool.h>. (TRUE, FALSE): Remove macros. (BODY for FROM_LOOP): Remove unused variable rp1. (ONEBYTE_BODY): New macro. (BODY for TO_LOOP): Use bool. * iconvdata/ibm932.h (__ibm932sb_to_ucs4_idx): Remove array. * iconvdata/ibm943.c: Include <stdbool.h>. (TRUE, FALSE): Remove macros. (BODY for FROM_LOOP): Remove unused variable rp1. (ONEBYTE_BODY): New macro. (BODY for TO_LOOP): Use bool. * iconvdata/ibm943.h (__ibm943sb_to_ucs4_idx): Remove array. * iconvdata/iso8859-1.c (ONEBYTE_BODY): New macro. * iconvdata/iso_6937-2.c (ONEBYTE_BODY): New macro. * iconvdata/iso_6937.c (ONEBYTE_BODY): New macro. * iconvdata/johab.c (ONEBYTE_BODY): New macro. * iconvdata/sjis.c (ONEBYTE_BODY): New macro. * iconvdata/shift_jisx0213.c (ONEBYTE_BODY): New macro. * iconvdata/t.61.c (ONEBYTE_BODY): New macro. * iconvdata/uhc.c (ONEBYTE_BODY): New macro. * iconvdata/gbbig5.c: Tweak comment.
2002-12-02 23:39:58 +01:00
/* Call the init function. */
if (result->__init_fct != NULL)
{
__gconv_init_fct init_fct = result->__init_fct;
#ifdef PTR_DEMANGLE
PTR_DEMANGLE (init_fct);
#endif
status = DL_CALL_FCT (init_fct, (result));
#ifdef PTR_MANGLE
if (result->__btowc_fct != NULL)
PTR_MANGLE (result->__btowc_fct);
#endif
}
}
return status;
}
#endif
int
internal_function
__gconv_compare_alias_cache (const char *name1, const char *name2, int *result)
{
size_t name1_idx;
size_t name2_idx;
Update. 2002-08-04 Ulrich Drepper <drepper@redhat.com> * stdio-common/psignal.c: Declare _sys_siglist_internal. Use USEINT to access _sys_siglist. * string/strsignal.c: Likewise. * sysdeps/generic/siglist.c: Add _sys_siglist_internal alias. * sysdeps/gnu/siglist.c: Likewise. * sysdeps/unix/siglist.c: Likewise. * sysdeps/unix/sysv/linux/arm/siglist.c: Likewise. * libio/fileops.c: Add missing INTUSEs for _IO_file_jumps. * libio/wfileops.c: Add missing INTUSE for _IO_file_close. * intl/dcigettext.c: Define _nl_default_dirname_internal as hidden alias and use it. * intl/bindtextdom.c: Use _nl_default_dirname_internal. * include/netinet/in.h: Add declaration of in6addr_loopback_internal. * inet/in6_addr.c: Add INTVARDEF for in6addr_loopback. * sysdeps/posix/getaddrinfo.c: Use INTUSE for in6addr_loopback access. * include/time.h: Add libc_hidden_proto for __gmtime_r. * time/gmtime.c (__gmtime_r): Add libc_hidden_def. * iconv/Versions: Replace __gconv_alias_db, __gconv_modules_db, and __gconv_cache with __gconv_get_alias_db, __gconv_get_modules_db, and __gconv_get_cache respectively. * iconv/gconv_cache.c (gconv_cache): Renamed for __gconv_cache and defined static. Change all users. (__gconv_get_cache): New function. * iconv/gconv_db.c (__gconv_get_modules_db): New function. (__gconv_get_alias_db): New function. * iconv/gconv_int.h (__gconv_alias_db): Declare as hidden. (__conv_modules_db): Likewise. Add prototypes for __gconv_get_cache, __gconv_get_modules_db, and __gconv_get_alias_db. * iconv/iconv_prog.c: Use the new functions instead of accessing the variables. * include/stdlib.h: Add prototype and libc_hidden_proto for __default_morecore. * sysdeps/generic/morecore.c: Include <stdlib.h>. * malloc/obstack.c: Remove fputs macro. * malloc/mtrace.c: Remove fopen macro.
2002-08-05 01:32:14 +02:00
if (gconv_cache == NULL)
return -1;
if (find_module_idx (name1, &name1_idx) != 0
|| find_module_idx (name2, &name2_idx) != 0)
*result = strcmp (name1, name2);
else
*result = (int) (name1_idx - name2_idx);
return 0;
}
int
internal_function
__gconv_lookup_cache (const char *toset, const char *fromset,
struct __gconv_step **handle, size_t *nsteps, int flags)
{
const struct gconvcache_header *header;
const char *strtab;
size_t fromidx;
size_t toidx;
const struct module_entry *modtab;
const struct module_entry *from_module;
const struct module_entry *to_module;
struct __gconv_step *result;
Update. 2002-08-04 Ulrich Drepper <drepper@redhat.com> * stdio-common/psignal.c: Declare _sys_siglist_internal. Use USEINT to access _sys_siglist. * string/strsignal.c: Likewise. * sysdeps/generic/siglist.c: Add _sys_siglist_internal alias. * sysdeps/gnu/siglist.c: Likewise. * sysdeps/unix/siglist.c: Likewise. * sysdeps/unix/sysv/linux/arm/siglist.c: Likewise. * libio/fileops.c: Add missing INTUSEs for _IO_file_jumps. * libio/wfileops.c: Add missing INTUSE for _IO_file_close. * intl/dcigettext.c: Define _nl_default_dirname_internal as hidden alias and use it. * intl/bindtextdom.c: Use _nl_default_dirname_internal. * include/netinet/in.h: Add declaration of in6addr_loopback_internal. * inet/in6_addr.c: Add INTVARDEF for in6addr_loopback. * sysdeps/posix/getaddrinfo.c: Use INTUSE for in6addr_loopback access. * include/time.h: Add libc_hidden_proto for __gmtime_r. * time/gmtime.c (__gmtime_r): Add libc_hidden_def. * iconv/Versions: Replace __gconv_alias_db, __gconv_modules_db, and __gconv_cache with __gconv_get_alias_db, __gconv_get_modules_db, and __gconv_get_cache respectively. * iconv/gconv_cache.c (gconv_cache): Renamed for __gconv_cache and defined static. Change all users. (__gconv_get_cache): New function. * iconv/gconv_db.c (__gconv_get_modules_db): New function. (__gconv_get_alias_db): New function. * iconv/gconv_int.h (__gconv_alias_db): Declare as hidden. (__conv_modules_db): Likewise. Add prototypes for __gconv_get_cache, __gconv_get_modules_db, and __gconv_get_alias_db. * iconv/iconv_prog.c: Use the new functions instead of accessing the variables. * include/stdlib.h: Add prototype and libc_hidden_proto for __default_morecore. * sysdeps/generic/morecore.c: Include <stdlib.h>. * malloc/obstack.c: Remove fputs macro. * malloc/mtrace.c: Remove fopen macro.
2002-08-05 01:32:14 +02:00
if (gconv_cache == NULL)
/* We have no cache available. */
return __GCONV_NODB;
Update. 2002-08-04 Ulrich Drepper <drepper@redhat.com> * stdio-common/psignal.c: Declare _sys_siglist_internal. Use USEINT to access _sys_siglist. * string/strsignal.c: Likewise. * sysdeps/generic/siglist.c: Add _sys_siglist_internal alias. * sysdeps/gnu/siglist.c: Likewise. * sysdeps/unix/siglist.c: Likewise. * sysdeps/unix/sysv/linux/arm/siglist.c: Likewise. * libio/fileops.c: Add missing INTUSEs for _IO_file_jumps. * libio/wfileops.c: Add missing INTUSE for _IO_file_close. * intl/dcigettext.c: Define _nl_default_dirname_internal as hidden alias and use it. * intl/bindtextdom.c: Use _nl_default_dirname_internal. * include/netinet/in.h: Add declaration of in6addr_loopback_internal. * inet/in6_addr.c: Add INTVARDEF for in6addr_loopback. * sysdeps/posix/getaddrinfo.c: Use INTUSE for in6addr_loopback access. * include/time.h: Add libc_hidden_proto for __gmtime_r. * time/gmtime.c (__gmtime_r): Add libc_hidden_def. * iconv/Versions: Replace __gconv_alias_db, __gconv_modules_db, and __gconv_cache with __gconv_get_alias_db, __gconv_get_modules_db, and __gconv_get_cache respectively. * iconv/gconv_cache.c (gconv_cache): Renamed for __gconv_cache and defined static. Change all users. (__gconv_get_cache): New function. * iconv/gconv_db.c (__gconv_get_modules_db): New function. (__gconv_get_alias_db): New function. * iconv/gconv_int.h (__gconv_alias_db): Declare as hidden. (__conv_modules_db): Likewise. Add prototypes for __gconv_get_cache, __gconv_get_modules_db, and __gconv_get_alias_db. * iconv/iconv_prog.c: Use the new functions instead of accessing the variables. * include/stdlib.h: Add prototype and libc_hidden_proto for __default_morecore. * sysdeps/generic/morecore.c: Include <stdlib.h>. * malloc/obstack.c: Remove fputs macro. * malloc/mtrace.c: Remove fopen macro.
2002-08-05 01:32:14 +02:00
header = (const struct gconvcache_header *) gconv_cache;
strtab = (char *) gconv_cache + header->string_offset;
modtab = (const struct module_entry *) ((char *) gconv_cache
+ header->module_offset);
if (find_module_idx (fromset, &fromidx) != 0
|| (header->module_offset + (fromidx + 1) * sizeof (struct module_entry)
> cache_size))
return __GCONV_NOCONV;
from_module = &modtab[fromidx];
if (find_module_idx (toset, &toidx) != 0
|| (header->module_offset + (toidx + 1) * sizeof (struct module_entry)
> cache_size))
return __GCONV_NOCONV;
to_module = &modtab[toidx];
/* Avoid copy-only transformations if the user requests. */
if (__builtin_expect (flags & GCONV_AVOID_NOCONV, 0) && fromidx == toidx)
return __GCONV_NULCONV;
/* If there are special conversions available examine them first. */
if (fromidx != 0 && toidx != 0
&& __builtin_expect (from_module->extra_offset, 0) != 0)
{
/* Search through the list to see whether there is a module
matching the destination character set. */
const struct extra_entry *extra;
/* Note the -1. This is due to the offset added in iconvconfig.
See there for more explanations. */
Update. 2002-08-04 Ulrich Drepper <drepper@redhat.com> * stdio-common/psignal.c: Declare _sys_siglist_internal. Use USEINT to access _sys_siglist. * string/strsignal.c: Likewise. * sysdeps/generic/siglist.c: Add _sys_siglist_internal alias. * sysdeps/gnu/siglist.c: Likewise. * sysdeps/unix/siglist.c: Likewise. * sysdeps/unix/sysv/linux/arm/siglist.c: Likewise. * libio/fileops.c: Add missing INTUSEs for _IO_file_jumps. * libio/wfileops.c: Add missing INTUSE for _IO_file_close. * intl/dcigettext.c: Define _nl_default_dirname_internal as hidden alias and use it. * intl/bindtextdom.c: Use _nl_default_dirname_internal. * include/netinet/in.h: Add declaration of in6addr_loopback_internal. * inet/in6_addr.c: Add INTVARDEF for in6addr_loopback. * sysdeps/posix/getaddrinfo.c: Use INTUSE for in6addr_loopback access. * include/time.h: Add libc_hidden_proto for __gmtime_r. * time/gmtime.c (__gmtime_r): Add libc_hidden_def. * iconv/Versions: Replace __gconv_alias_db, __gconv_modules_db, and __gconv_cache with __gconv_get_alias_db, __gconv_get_modules_db, and __gconv_get_cache respectively. * iconv/gconv_cache.c (gconv_cache): Renamed for __gconv_cache and defined static. Change all users. (__gconv_get_cache): New function. * iconv/gconv_db.c (__gconv_get_modules_db): New function. (__gconv_get_alias_db): New function. * iconv/gconv_int.h (__gconv_alias_db): Declare as hidden. (__conv_modules_db): Likewise. Add prototypes for __gconv_get_cache, __gconv_get_modules_db, and __gconv_get_alias_db. * iconv/iconv_prog.c: Use the new functions instead of accessing the variables. * include/stdlib.h: Add prototype and libc_hidden_proto for __default_morecore. * sysdeps/generic/morecore.c: Include <stdlib.h>. * malloc/obstack.c: Remove fputs macro. * malloc/mtrace.c: Remove fopen macro.
2002-08-05 01:32:14 +02:00
extra = (const struct extra_entry *) ((char *) gconv_cache
+ header->otherconv_offset
+ from_module->extra_offset - 1);
while (extra->module_cnt != 0
&& extra->module[extra->module_cnt - 1].outname_offset != toidx)
extra = (const struct extra_entry *) ((char *) extra
+ sizeof (struct extra_entry)
+ (extra->module_cnt
* sizeof (struct extra_entry_module)));
if (extra->module_cnt != 0)
{
/* Use the extra module. First determine how many steps. */
char *fromname;
int idx;
*nsteps = extra->module_cnt;
*handle = result =
(struct __gconv_step *) malloc (extra->module_cnt
* sizeof (struct __gconv_step));
if (result == NULL)
return __GCONV_NOMEM;
fromname = (char *) strtab + from_module->canonname_offset;
idx = 0;
do
{
result[idx].__from_name = fromname;
fromname = result[idx].__to_name =
(char *) strtab + modtab[extra->module[idx].outname_offset].canonname_offset;
result[idx].__counter = 1;
result[idx].__data = NULL;
#ifndef STATIC_GCONV
if (strtab[extra->module[idx].dir_offset] != '\0')
{
/* Load the module, return handle for it. */
int res;
res = find_module (strtab + extra->module[idx].dir_offset,
strtab + extra->module[idx].name_offset,
&result[idx]);
if (__builtin_expect (res, __GCONV_OK) != __GCONV_OK)
{
/* Something went wrong. */
free (result);
goto try_internal;
}
}
else
#endif
/* It's a builtin transformation. */
__gconv_get_builtin_trans (strtab
+ extra->module[idx].name_offset,
&result[idx]);
}
while (++idx < extra->module_cnt);
return __GCONV_OK;
}
}
try_internal:
/* See whether we can convert via the INTERNAL charset. */
if ((fromidx != 0 && __builtin_expect (from_module->fromname_offset, 1) == 0)
|| (toidx != 0 && __builtin_expect (to_module->toname_offset, 1) == 0)
|| (fromidx == 0 && toidx == 0))
/* Not possible. Nothing we can do. */
return __GCONV_NOCONV;
/* We will use up to two modules. Always allocate room for two. */
result = (struct __gconv_step *) malloc (2 * sizeof (struct __gconv_step));
if (result == NULL)
return __GCONV_NOMEM;
*handle = result;
*nsteps = 0;
/* Generate data structure for conversion to INTERNAL. */
if (fromidx != 0)
{
result[0].__from_name = (char *) strtab + from_module->canonname_offset;
result[0].__to_name = (char *) "INTERNAL";
result[0].__counter = 1;
result[0].__data = NULL;
#ifndef STATIC_GCONV
if (strtab[from_module->todir_offset] != '\0')
{
/* Load the module, return handle for it. */
int res = find_module (strtab + from_module->todir_offset,
strtab + from_module->toname_offset,
&result[0]);
if (__builtin_expect (res, __GCONV_OK) != __GCONV_OK)
{
/* Something went wrong. */
free (result);
return res;
}
}
else
#endif
/* It's a builtin transformation. */
__gconv_get_builtin_trans (strtab + from_module->toname_offset,
&result[0]);
++*nsteps;
}
/* Generate data structure for conversion from INTERNAL. */
if (toidx != 0)
{
int idx = *nsteps;
result[idx].__from_name = (char *) "INTERNAL";
result[idx].__to_name = (char *) strtab + to_module->canonname_offset;
result[idx].__counter = 1;
result[idx].__data = NULL;
#ifndef STATIC_GCONV
if (strtab[to_module->fromdir_offset] != '\0')
{
/* Load the module, return handle for it. */
int res = find_module (strtab + to_module->fromdir_offset,
strtab + to_module->fromname_offset,
&result[idx]);
if (__builtin_expect (res, __GCONV_OK) != __GCONV_OK)
{
/* Something went wrong. */
if (idx != 0)
__gconv_release_step (&result[0]);
free (result);
return res;
}
}
else
#endif
/* It's a builtin transformation. */
__gconv_get_builtin_trans (strtab + to_module->fromname_offset,
&result[idx]);
++*nsteps;
}
return __GCONV_OK;
}
/* Free memory allocated for the transformation record. */
void
internal_function
__gconv_release_cache (struct __gconv_step *steps, size_t nsteps)
{
Update. 2002-08-04 Ulrich Drepper <drepper@redhat.com> * stdio-common/psignal.c: Declare _sys_siglist_internal. Use USEINT to access _sys_siglist. * string/strsignal.c: Likewise. * sysdeps/generic/siglist.c: Add _sys_siglist_internal alias. * sysdeps/gnu/siglist.c: Likewise. * sysdeps/unix/siglist.c: Likewise. * sysdeps/unix/sysv/linux/arm/siglist.c: Likewise. * libio/fileops.c: Add missing INTUSEs for _IO_file_jumps. * libio/wfileops.c: Add missing INTUSE for _IO_file_close. * intl/dcigettext.c: Define _nl_default_dirname_internal as hidden alias and use it. * intl/bindtextdom.c: Use _nl_default_dirname_internal. * include/netinet/in.h: Add declaration of in6addr_loopback_internal. * inet/in6_addr.c: Add INTVARDEF for in6addr_loopback. * sysdeps/posix/getaddrinfo.c: Use INTUSE for in6addr_loopback access. * include/time.h: Add libc_hidden_proto for __gmtime_r. * time/gmtime.c (__gmtime_r): Add libc_hidden_def. * iconv/Versions: Replace __gconv_alias_db, __gconv_modules_db, and __gconv_cache with __gconv_get_alias_db, __gconv_get_modules_db, and __gconv_get_cache respectively. * iconv/gconv_cache.c (gconv_cache): Renamed for __gconv_cache and defined static. Change all users. (__gconv_get_cache): New function. * iconv/gconv_db.c (__gconv_get_modules_db): New function. (__gconv_get_alias_db): New function. * iconv/gconv_int.h (__gconv_alias_db): Declare as hidden. (__conv_modules_db): Likewise. Add prototypes for __gconv_get_cache, __gconv_get_modules_db, and __gconv_get_alias_db. * iconv/iconv_prog.c: Use the new functions instead of accessing the variables. * include/stdlib.h: Add prototype and libc_hidden_proto for __default_morecore. * sysdeps/generic/morecore.c: Include <stdlib.h>. * malloc/obstack.c: Remove fputs macro. * malloc/mtrace.c: Remove fopen macro.
2002-08-05 01:32:14 +02:00
if (gconv_cache != NULL)
/* The only thing we have to deallocate is the record with the
steps. */
free (steps);
}
/* Free all resources if necessary. */
* include/libc-symbols.h (__libc_freeres_fn_section, libc_freeres_fn): New macros. * elf/dl-close.c (free_mem): Use libc_freeres_fn macro, remove text_set_element. * elf/dl-libc.c (free_mem): Likewise. * iconv/gconv_conf.c (free_mem): Likewise. * iconv/gconv_db.c (free_mem): Likewise. * iconv/gconv_dl.c (free_mem): Likewise. * iconv/gconv_cache.c (free_mem): Likewise. * intl/finddomain.c (free_mem): Likewise. * intl/dcigettext.c (free_mem): Likewise. * locale/setlocale.c (free_mem): Likewise. * misc/fstab.c (fstab_free): Likewise. * nss/nsswitch.c (free_mem): Likewise. * posix/regcomp.c (free_mem): Likewise. * resolv/gai_misc.c (free_res): Likewise. * stdlib/fmtmsg.c (free_mem): Likewise. * sunrpc/clnt_perr.c (free_mem): Likewise. * sysdeps/generic/setenv.c (free_mem): Likewise. * sysdeps/unix/sysv/linux/shm_open.c (freeit): Likewise. * sysdeps/pthread/aio_misc.c (free_res): Likewise. * time/tzset.c (free_mem): Likewise. * malloc/mtrace.c (release_libc_mem): Add __libc_freeres_fn_section. * locale/loadarchive.c (_nl_archive_subfreeres): Likewise. * malloc/set-freeres.c (__libc_freeres): Likewise. * login/getutent.c: Include stdlib.h instead of stddef.h. (buffer): Change into pointer to utmp, add libc_freeres_ptr. (__getutent): Allocate buffer the first time it is run. * login/getutid.c: Include stdlib.h instead of stddef.h. (buffer): Change into pointer to utmp, add libc_freeres_ptr. (__getutid): Allocate buffer the first time it is run. * login/getutline.c: Include stdlib.h instead of stddef.h. (buffer): Change into pointer to utmp, add libc_freeres_ptr. (__getutline): Allocate buffer the first time it is run. * malloc/mtrace.c (malloc_trace_buffer): Change into char *. (mtrace): Allocate malloc_trace_buffer. * resolv/nsap_addr.c (inet_nsap_ntoa): Decrease size of tmpbuf. * resolv/ns_print.c (ns_sprintrrf): Decrease size of t. * string/strerror.c: Include libintl.h and errno.h. (buf): New variable. (strerror): Only allocate buffer if actually needed (unknown error). * time/tzfile.c (transitions): Add libc_freeres_ptr. (freeres): Remove. 2002-10-25 Jakub Jelinek <jakub@redhat.com> * include/libc-symbols.h (libc_freeres_ptr): New macro. * malloc/set-freeres.c (__libc_freeres_ptrs): Define using symbol_set_define. (__libc_freeres): Free all pointers in that section. * Makerules (build-shlib): Add $(LDSEDCMD-$(@F:lib%.so=%).so) to sed commands when creating .lds script. (LDSEDCMD-c.so): New variable. * inet/rcmd.c (ahostbuf): Change into char *. Add libc_freeres_ptr. (rcmd_af): Use strdup to allocate ahostbuf. * inet/rexec.c (ahostbuf): Change into char *. Add libc_freeres_ptr. (rexec_af): Use strdup to allocate ahostbuf. * stdio-common/reg-printf.c (printf_funcs): Remove. (__printf_arginfo_table): Change into printf_arginfo_function **. Add libc_freeres_ptr. (__register_printf_function): Allocate __printf_arginfo_table and __printf_function_table the first time it is called. * stdio-common/printf-parse.h (__printf_arginfo_table): Change into printf_arginfo_function **. (parse_one_spec): Add __builtin_expect. * grp/fgetgrent.c (buffer): Add libc_freeres_ptr. (free_mem): Remove. * inet/getnetgrent.c (buffer): Add libc_freeres_ptr. (free_mem): Remove. * intl/localealias.c (libc_freeres_ptr): Define if !_LIBC. (string_space, map): Add libc_freeres_ptr. (free_mem): Remove. * misc/efgcvt.c (FCVT_BUFPTR): Add libc_freeres_ptr. (free_mem): Remove. * misc/mntent.c (getmntent_buffer): Add libc_freeres_ptr. (free_mem): Remove. * crypt/md5-crypt.c (libc_freeres_ptr): Define if !_LIBC. (buffer): Add libc_freeres_ptr. (free_mem): Remove for _LIBC. * nss/getXXbyYY.c (buffer): Add libc_freeres_ptr. (free_mem): Remove. * nss/getXXent.c (buffer): Add libc_freeres_ptr. (free_mem): Remove. * pwd/fgetpwent.c (buffer): Add libc_freeres_ptr. (free_mem): Remove. * resolv/res_hconf.c (ifaddrs): Add libc_freeres_ptr. (free_mem): Remove. * shadow/fgetspent.c (buffer): Add libc_freeres_ptr. (free_mem): Remove. * sysdeps/posix/ttyname.c (getttyname_name): Add libc_freeres_ptr. (free_mem): Remove. * sysdeps/unix/sysv/linux/getsysstats.c (mount_proc): Add libc_freeres_ptr. (free_mem): Remove. * sysdeps/unix/sysv/linux/ttyname.c (getttyname_name, ttyname_buf): Add libc_freeres_ptr. (free_mem): Remove. 2002-10-30 Jakub Jelinek <jakub@redhat.com> * malloc/obstack.c [_LIBC] (obstack_free): Change into strong_alias instead of duplicating the whole function in libc.
2002-11-01 21:44:15 +01:00
libc_freeres_fn (free_mem)
{
if (cache_malloced)
Update. 2002-08-04 Ulrich Drepper <drepper@redhat.com> * stdio-common/psignal.c: Declare _sys_siglist_internal. Use USEINT to access _sys_siglist. * string/strsignal.c: Likewise. * sysdeps/generic/siglist.c: Add _sys_siglist_internal alias. * sysdeps/gnu/siglist.c: Likewise. * sysdeps/unix/siglist.c: Likewise. * sysdeps/unix/sysv/linux/arm/siglist.c: Likewise. * libio/fileops.c: Add missing INTUSEs for _IO_file_jumps. * libio/wfileops.c: Add missing INTUSE for _IO_file_close. * intl/dcigettext.c: Define _nl_default_dirname_internal as hidden alias and use it. * intl/bindtextdom.c: Use _nl_default_dirname_internal. * include/netinet/in.h: Add declaration of in6addr_loopback_internal. * inet/in6_addr.c: Add INTVARDEF for in6addr_loopback. * sysdeps/posix/getaddrinfo.c: Use INTUSE for in6addr_loopback access. * include/time.h: Add libc_hidden_proto for __gmtime_r. * time/gmtime.c (__gmtime_r): Add libc_hidden_def. * iconv/Versions: Replace __gconv_alias_db, __gconv_modules_db, and __gconv_cache with __gconv_get_alias_db, __gconv_get_modules_db, and __gconv_get_cache respectively. * iconv/gconv_cache.c (gconv_cache): Renamed for __gconv_cache and defined static. Change all users. (__gconv_get_cache): New function. * iconv/gconv_db.c (__gconv_get_modules_db): New function. (__gconv_get_alias_db): New function. * iconv/gconv_int.h (__gconv_alias_db): Declare as hidden. (__conv_modules_db): Likewise. Add prototypes for __gconv_get_cache, __gconv_get_modules_db, and __gconv_get_alias_db. * iconv/iconv_prog.c: Use the new functions instead of accessing the variables. * include/stdlib.h: Add prototype and libc_hidden_proto for __default_morecore. * sysdeps/generic/morecore.c: Include <stdlib.h>. * malloc/obstack.c: Remove fputs macro. * malloc/mtrace.c: Remove fopen macro.
2002-08-05 01:32:14 +02:00
free (gconv_cache);
#ifdef _POSIX_MAPPED_FILES
else if (gconv_cache != NULL)
Update. 2002-08-04 Ulrich Drepper <drepper@redhat.com> * stdio-common/psignal.c: Declare _sys_siglist_internal. Use USEINT to access _sys_siglist. * string/strsignal.c: Likewise. * sysdeps/generic/siglist.c: Add _sys_siglist_internal alias. * sysdeps/gnu/siglist.c: Likewise. * sysdeps/unix/siglist.c: Likewise. * sysdeps/unix/sysv/linux/arm/siglist.c: Likewise. * libio/fileops.c: Add missing INTUSEs for _IO_file_jumps. * libio/wfileops.c: Add missing INTUSE for _IO_file_close. * intl/dcigettext.c: Define _nl_default_dirname_internal as hidden alias and use it. * intl/bindtextdom.c: Use _nl_default_dirname_internal. * include/netinet/in.h: Add declaration of in6addr_loopback_internal. * inet/in6_addr.c: Add INTVARDEF for in6addr_loopback. * sysdeps/posix/getaddrinfo.c: Use INTUSE for in6addr_loopback access. * include/time.h: Add libc_hidden_proto for __gmtime_r. * time/gmtime.c (__gmtime_r): Add libc_hidden_def. * iconv/Versions: Replace __gconv_alias_db, __gconv_modules_db, and __gconv_cache with __gconv_get_alias_db, __gconv_get_modules_db, and __gconv_get_cache respectively. * iconv/gconv_cache.c (gconv_cache): Renamed for __gconv_cache and defined static. Change all users. (__gconv_get_cache): New function. * iconv/gconv_db.c (__gconv_get_modules_db): New function. (__gconv_get_alias_db): New function. * iconv/gconv_int.h (__gconv_alias_db): Declare as hidden. (__conv_modules_db): Likewise. Add prototypes for __gconv_get_cache, __gconv_get_modules_db, and __gconv_get_alias_db. * iconv/iconv_prog.c: Use the new functions instead of accessing the variables. * include/stdlib.h: Add prototype and libc_hidden_proto for __default_morecore. * sysdeps/generic/morecore.c: Include <stdlib.h>. * malloc/obstack.c: Remove fputs macro. * malloc/mtrace.c: Remove fopen macro.
2002-08-05 01:32:14 +02:00
__munmap (gconv_cache, cache_size);
#endif
}