From 8619129f3f0d5a9db6208be5bae6c2a8c9ce61a5 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 20 Apr 1998 18:41:05 +0000 Subject: Update. 1998-04-20 18:00 Ulrich Drepper * libc.map: Add __dgettext to GLIBC_2.0 and __libc_longjmp, and __libc_siglongjmp to GLIBC_2.1. * elf/dl-minimal.c (__assert_perror_fail): Don't use strerror, use __strerror_r. * iconv/Makefile: Don't run tests now. * iconv/iconv_prog.c (process_block): If loop is repeated, call iconv with correct output buffer. Major rewrite of the low-level gconv functionality. * iconv/gconv.c: Rewritten. * iconv/gconv.h: Likewise. * iconv/gconv_builtin.c: Likewise. * iconv/gconv_builtin.h: Likewise. * iconv/gconv_conf.c: Likewise. * iconv/gconv_int.h: Likewise. * iconv/gconv_open.c: Likewise. * iconv/gconv_simple.c: Likewise. * iconv/iconv.c: Likewise. * iconvdata/8bit-gap.c: Likewise. * iconvdata/8bit-generic.c: Likewise. * iconvdata/Makefile: Likewise. * iconvdata/big5.c: Likewise. * iconvdata/cns11643.c: Likewise. * iconvdata/cns11643.h: Likewise. * iconvdata/cns11643l1.c: Likewise. * iconvdata/cns11643l1.h: Likewise. * iconvdata/ebcdic-at-de-a.c: Likewise. * iconvdata/ebcdic-at-de.c: Likewise. * iconvdata/ebcdic-ca-fr.c: Likewise. * iconvdata/euccn.c: Likewise. * iconvdata/eucjp.c: Likewise. * iconvdata/euckr.c: Likewise. * iconvdata/euctw.c: Likewise. * iconvdata/gb2312.c: Likewise. * iconvdata/gb2312.h: Likewise. * iconvdata/hp-roman8.c: Likewise. * iconvdata/iso646.c: Likewise. * iconvdata/iso6937.c: Likewise. * iconvdata/iso8859-1.c: Likewise. * iconvdata/iso8859-10.c: Likewise. * iconvdata/iso8859-2.c: Likewise. * iconvdata/iso8859-3.c: Likewise. * iconvdata/iso8859-4.c: Likewise. * iconvdata/iso8859-5.c: Likewise. * iconvdata/iso8859-6.c: Likewise. * iconvdata/iso8859-7.c: Likewise. * iconvdata/iso8859-8.c: Likewise. * iconvdata/iso8859-9.c: Likewise. * iconvdata/jis0201.c: Likewise. * iconvdata/jis0201.h: Likewise. * iconvdata/jis0208.c: Likewise. * iconvdata/jis0208.h: Likewise. * iconvdata/jis0212.c: Likewise. * iconvdata/jis0212.h: Likewise. * iconvdata/johab.c: Likewise. * iconvdata/koi-8.c: Likewise. * iconvdata/koi8-r.c: Likewise. * iconvdata/ksc5601.c: Likewise. * iconvdata/ksc5601.h: Likewise. * iconvdata/latin-greek-1.c: Likewise. * iconvdata/latin-greek.c: Likewise. * iconvdata/run-iconv-test.sh: Likewise. * iconvdata/sjis.c: Likewise. * iconvdata/t61.c: Likewise. * iconvdata/uhc.c: Likewise. * wcsmbs/btowc.c: Likewise. * wcsmbs/mbrtowc.c: Likewise. * wcsmbs/mbsnrtowcs.c: Likewise. * wcsmbs/mbsrtowcs.c: Likewise. * wcsmbs/wcrtomb.c: Likewise. * wcsmbs/wcsmbsload.c: Likewise. * wcsmbs/wcsnrtombs.c: Likewise. * wcsmbs/wcsrtombs.c: Likewise. * wcsmbs/wctob.c: Likewise. * iconv/loop.c: New file. * iconv/skeleton.c: New file. * stdlib/mblen.c: Handle empty input string correctly. * stdlib/mbtowc.c: Likewise. * posix/getopt.c: Various cleanups. * sysdeps/arm/bits/setjmp.h: Add copyright text. * sysdeps/i386/bits/setjmp.h: Likewise. * sysdeps/m68k/bits/setjmp.h: Likewise. * sysdeps/powerpc/bits/setjmp.h: Likewise. * sysdeps/sparc/sparc32/bits/setjmp.h: Likewise. * sysdeps/generic/longjmp.c: Rename function to __libc_siglongjmp and make longjmp weak alias. 1998-04-18 20:29 Philip Blundell * iconv/Makefile (routines): Only include gconv_dl if building for an ELF system - dynamic linking is not available on a.out. (CFLAGS-gconv_conf.c): Define STATIC_GCONV if omitting gconv_dl due to above check. * iconv/gconv_db.c: If STATIC_GCONV defined, don't try to call routines from gconv_dl. 1998-04-17 Gordon Matzigkeit * csu/init.c (_IO_stdin_used): Protect with USE_IN_LIBIO so that we can compile without libio. 1998-04-20 16:28 Ulrich Drepper * sysdeps/mach/hurd/Subdirs: Remove login. 1998-04-11 Gordon Matzigkeit * db2/compat.h: Include , to make sure we get the definition of EFTYPE before we define it ourselves. 1998-04-10 Gordon Matzigkeit * sysdeps/generic/bits/socket.h: Protect against multiple inclusion. * sysdeps/mach/hurd/bits/ioctls.h: Likewise. Fix typo to allow inclusion from sys/ioctl.h again. 1998-04-16 Andreas Schwab * iconvdata/*.[ch]: Clean up namespace. Optimize character lookup. 1998-04-16 Andreas Schwab * libc.map: Export __strerror_r. Remove _strerror_internal. 1998-04-16 Andreas Schwab * sysdeps/generic/strcasestr.c: Undefine strcasestr, not strstr. Also undefine __strcasestr. 1998-04-16 Andreas Schwab * posix/regex.c: Rename __re_max_failures back to re_max_failures, aliases do not work with global variables due to copy relocations. 1998-04-20 15:12 Ulrich Drepper * manual/creature.texi: Fix type. Patch by Andreas Schwab. 1998-04-20 13:47 Ulrich Drepper * signal/sighold.c: Include stddef.h for NULL definition. * signal/sigrelse.c: Likewise. * sysdeps/posix/sigignore.c: Likewise. * sysdeps/posix/sigset.c: Likewise. * sysdeps/posix/waitid.c: Likewise. * sysdeps/unix/sysv/linux/rt_sigsuspend.c: Likewise. * sysdeps/unix/sysv/linux/rt_sigtimedwait.c: Likewise. * sysdeps/unix/sysv/linux/sigwaitinfo.c: Likewise. * wcsmbs/mbsrtowcs.c: Include stdlib.h for MB_CUR_MAX. Patch by Franz Sirl . 1998-04-13 Mark Kettenis * login/Makefile (headers): Remove utmpx.h and bits/utmpx.h. * login/getutent.c (getutxent): Remove alias. * login/getutent_r.c (setutxent, pututxline, endutxent): Remove aliases. * login/getutid.c (getutxid): Remove alias. * login/getutline.c (getutxline): Remove alias. * login/utmp.h: Add prototypes for __updwtmp, __getutent, __getutid, __getutline and __pututline. * login/utmpx.h: Moved to ... * sysdeps/gnu/utmpx.h: ... here. [__USE_GNU]: Define UTMPX_FILE, UTMPX_FILENAME, WTMPX_FILE and WTMPX_FILENAME, declare utmpxname and updwtmpx. * login/updwtmp.c: Moved to ... * sysdeps/generic/updwtmp.c: ... here. (updwtmp): Generalized by allowing file name transformation. * sysdeps/gnu/updwtmp.c: New file. Use generic implementation with additional file name transformation. * sysdeps/unix/sysv/linux/updwtmp.c: Likewise. * login/utmp_file.c: Moved to ... * sysdeps/generic/utmp_file.c: ... here. (setutent_file): Generalized by allowing file name transformation. Do not print error message. Library functions should not print them. Reported by Jim Meyering. * sysdeps/gnu/utmp_file.c: New file. Use generic implementation with additional file name transformation. * sysdeps/unix/sysv/linux/utmp_file.c: Likewise. * sysdeps/gnu/Makefile [$(subdir)=login] (sysdep_routines): Add setutxent, getutxent, endutxent, getutxid, getutxid, getutxline, pututxline, utmpxname and updwtmpx. (sysdep_headers): Add utmpx.h and bits/utmpx.h. * sysdeps/gnu/bits/utmpx.h [__USE_GNU] Include paths.h. (_PATH_UTMPX): Define to _PATH_UTMP. (_PATH_WTMPX): Define to _PATH_WTMPX. (RUN_LVL): Define only if __USE_GNU. (ACCOUNTING): Define if __USE_GNU. * sysdeps/gnu/setutxent.c: New file. * sysdeps/gnu/getutxent.c: New file. * sysdeps/gnu/endutxent.c: New file. * sysdeps/gnu/getutxid.c: New file. * sysdeps/gnu/getutxline.c: New file. * sysdeps/gnu/pututxline.c: New file. * sysdeps/gnu/utmpxname.c: New file. * sysdeps/gnu/updwtmpx.c: New file. * sysdeps/unix/sysv/linux/paths.h (_PATH_UTMP_DB): Remove. * sysdeps/generic/bits/utmpx.h: Remove. 1998-04-20 Ulrich Drepper * posix/wordexp-test.c (main): Initialize ifs element of ts for ~root test. 1998-04-17 07:53 H.J. Lu * sysdeps/unix/sysv/linux/i386/s_pread64.S: Fix a typo. 1998-04-17 11:32 Ulrich Drepper * libio/oldfileops.c (_IO_old_file_seekoff): Define temporary st variable using _G_stat64. * libio/fileops.c: Remove macro definition of fstat, it is in the global header. Reported by Thorsten Kukuk . 1998-04-17 Philip Blundell * sysdeps/arm/strlen.S: New file, based on code by Matthew Wilcox . 1998-04-16 Philip Blundell * inet/netinet/in.h (IN6_IS_ADDR_MC_NODELOCAL): New macro, required by IPv6 Basic API. (IN6_IS_ADDR_MC_LINKLOCAL): Likewise. (IN6_IS_ADDR_MC_SITELOCAL): Likewise. (IN6_IS_ADDR_MC_ORGLOCAL): Likewise. (IN6_IS_ADDR_MC_GLOBAL): Likewise. --- ChangeLog | 238 ++++++ FAQ | 34 +- FAQ.in | 32 +- bits/socket.h | 5 + csu/init.c | 4 +- db2/compat.h | 1 + elf/dl-minimal.c | 5 +- iconv/Makefile | 10 +- iconv/gconv.c | 53 +- iconv/gconv.h | 14 +- iconv/gconv_builtin.c | 17 +- iconv/gconv_builtin.h | 21 +- iconv/gconv_conf.c | 4 +- iconv/gconv_db.c | 8 + iconv/gconv_int.h | 13 +- iconv/gconv_open.c | 17 +- iconv/gconv_simple.c | 1220 +++++++-------------------- iconv/iconv.c | 19 +- iconv/iconv_prog.c | 9 +- iconv/loop.c | 226 +++++ iconv/skeleton.c | 328 +++++++ iconvdata/8bit-gap.c | 255 ++---- iconvdata/8bit-generic.c | 236 ++---- iconvdata/Makefile | 6 +- iconvdata/big5.c | 451 ++++------ iconvdata/cns11643.c | 6 +- iconvdata/cns11643.h | 220 +++-- iconvdata/cns11643l1.c | 30 +- iconvdata/cns11643l1.h | 210 +++-- iconvdata/ebcdic-at-de-a.c | 11 +- iconvdata/ebcdic-at-de.c | 11 +- iconvdata/ebcdic-ca-fr.c | 11 +- iconvdata/euccn.c | 376 +++------ iconvdata/eucjp.c | 480 ++++------- iconvdata/euckr.c | 377 +++------ iconvdata/euctw.c | 459 ++++------ iconvdata/gb2312.c | 20 +- iconvdata/gb2312.h | 251 +++--- iconvdata/hp-roman8.c | 11 +- iconvdata/iso646.c | 12 +- iconvdata/iso6937.c | 464 ++++------ iconvdata/iso8859-1.c | 217 +---- iconvdata/iso8859-10.c | 10 +- iconvdata/iso8859-2.c | 10 +- iconvdata/iso8859-3.c | 10 +- iconvdata/iso8859-4.c | 10 +- iconvdata/iso8859-5.c | 10 +- iconvdata/iso8859-6.c | 10 +- iconvdata/iso8859-7.c | 10 +- iconvdata/iso8859-8.c | 10 +- iconvdata/iso8859-9.c | 10 +- iconvdata/jis0201.c | 6 +- iconvdata/jis0201.h | 8 +- iconvdata/jis0208.c | 16 +- iconvdata/jis0208.h | 34 +- iconvdata/jis0212.c | 13 +- iconvdata/jis0212.h | 32 +- iconvdata/johab.c | 546 +++++------- iconvdata/koi-8.c | 10 +- iconvdata/koi8-r.c | 11 +- iconvdata/ksc5601.c | 12 +- iconvdata/ksc5601.h | 53 +- iconvdata/latin-greek-1.c | 9 +- iconvdata/latin-greek.c | 9 +- iconvdata/run-iconv-test.sh | 10 +- iconvdata/sjis.c | 407 ++++----- iconvdata/t61.c | 370 +++----- iconvdata/uhc.c | 448 ++++------ inet/netinet/in.h | 16 + libc.map | 6 +- libio/fileops.c | 1 - libio/oldfileops.c | 2 +- linuxthreads/ChangeLog | 11 + linuxthreads/Makefile | 4 +- linuxthreads/internals.h | 17 + linuxthreads/ptlongjmp.c | 44 + linuxthreads/spinlock.c | 59 ++ linuxthreads/spinlock.h | 4 +- login/Makefile | 2 +- login/getutent.c | 3 +- login/getutent_r.c | 5 +- login/getutid.c | 3 +- login/getutline.c | 3 +- login/updwtmp.c | 46 - login/utmp.h | 8 +- login/utmp_file.c | 476 ----------- login/utmpx.h | 50 -- manual/creature.texi | 2 +- posix/getopt.c | 65 +- posix/regex.c | 21 - posix/wordexp-test.c | 19 +- signal/sighold.c | 2 + signal/sigrelse.c | 2 + stdlib/mblen.c | 30 +- stdlib/mbtowc.c | 24 +- sysdeps/arm/bits/setjmp.h | 18 + sysdeps/arm/strlen.S | 55 ++ sysdeps/generic/bits/socket.h | 5 + sysdeps/generic/bits/utmpx.h | 34 - sysdeps/generic/endutxent.c | 27 + sysdeps/generic/getutxent.c | 27 + sysdeps/generic/getutxid.c | 27 + sysdeps/generic/getutxline.c | 27 + sysdeps/generic/longjmp.c | 10 +- sysdeps/generic/pututxline.c | 27 + sysdeps/generic/setjmp.c | 6 +- sysdeps/generic/setutxent.c | 27 + sysdeps/generic/strcasestr.c | 5 +- sysdeps/generic/updwtmp.c | 41 + sysdeps/generic/updwtmpx.c | 27 + sysdeps/generic/utmp_file.c | 472 +++++++++++ sysdeps/generic/utmpxname.c | 27 + sysdeps/gnu/Makefile | 7 + sysdeps/gnu/bits/utmpx.h | 19 +- sysdeps/gnu/updwtmp.c | 30 + sysdeps/gnu/utmp_file.c | 30 + sysdeps/gnu/utmpx.h | 67 ++ sysdeps/i386/bits/setjmp.h | 18 + sysdeps/m68k/bits/setjmp.h | 18 + sysdeps/mach/hurd/Subdirs | 1 - sysdeps/mach/hurd/bits/ioctls.h | 7 +- sysdeps/posix/sigignore.c | 2 + sysdeps/posix/sigset.c | 2 + sysdeps/posix/waitid.c | 4 +- sysdeps/powerpc/bits/setjmp.h | 18 + sysdeps/powerpc/elf/start.c | 125 --- sysdeps/sparc/sparc32/bits/setjmp.h | 18 + sysdeps/unix/sysv/linux/i386/s_pread64.S | 2 +- sysdeps/unix/sysv/linux/paths.h | 1 - sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c | 5 +- sysdeps/unix/sysv/linux/powerpc/syscall.h | 357 -------- sysdeps/unix/sysv/linux/rt_sigsuspend.c | 4 +- sysdeps/unix/sysv/linux/rt_sigtimedwait.c | 4 +- sysdeps/unix/sysv/linux/sigwaitinfo.c | 4 +- sysdeps/unix/sysv/linux/updwtmp.c | 34 + sysdeps/unix/sysv/linux/utmp_file.c | 34 + wcsmbs/btowc.c | 8 +- wcsmbs/mbrtowc.c | 18 +- wcsmbs/mbsnrtowcs.c | 23 +- wcsmbs/mbsrtowcs.c | 23 +- wcsmbs/wcrtomb.c | 20 +- wcsmbs/wcsmbsload.c | 12 +- wcsmbs/wcsnrtombs.c | 35 +- wcsmbs/wcsrtombs.c | 35 +- wcsmbs/wctob.c | 13 +- 145 files changed, 5084 insertions(+), 6177 deletions(-) create mode 100644 iconv/loop.c create mode 100644 iconv/skeleton.c create mode 100644 linuxthreads/ptlongjmp.c create mode 100644 linuxthreads/spinlock.c delete mode 100644 login/updwtmp.c delete mode 100644 login/utmp_file.c delete mode 100644 login/utmpx.h create mode 100644 sysdeps/arm/strlen.S delete mode 100644 sysdeps/generic/bits/utmpx.h create mode 100644 sysdeps/generic/endutxent.c create mode 100644 sysdeps/generic/getutxent.c create mode 100644 sysdeps/generic/getutxid.c create mode 100644 sysdeps/generic/getutxline.c create mode 100644 sysdeps/generic/pututxline.c create mode 100644 sysdeps/generic/setutxent.c create mode 100644 sysdeps/generic/updwtmp.c create mode 100644 sysdeps/generic/updwtmpx.c create mode 100644 sysdeps/generic/utmp_file.c create mode 100644 sysdeps/generic/utmpxname.c create mode 100644 sysdeps/gnu/updwtmp.c create mode 100644 sysdeps/gnu/utmp_file.c create mode 100644 sysdeps/gnu/utmpx.h delete mode 100644 sysdeps/powerpc/elf/start.c delete mode 100644 sysdeps/unix/sysv/linux/powerpc/syscall.h create mode 100644 sysdeps/unix/sysv/linux/updwtmp.c create mode 100644 sysdeps/unix/sysv/linux/utmp_file.c diff --git a/ChangeLog b/ChangeLog index 65210542a1..105bed4c21 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,241 @@ +1998-04-20 18:00 Ulrich Drepper + + * libc.map: Add __dgettext to GLIBC_2.0 and __libc_longjmp, and + __libc_siglongjmp to GLIBC_2.1. + + * elf/dl-minimal.c (__assert_perror_fail): Don't use strerror, use + __strerror_r. + + * iconv/Makefile: Don't run tests now. + + * iconv/iconv_prog.c (process_block): If loop is repeated, call iconv + with correct output buffer. + + Major rewrite of the low-level gconv functionality. + * iconv/gconv.c: Rewritten. + * iconv/gconv.h: Likewise. + * iconv/gconv_builtin.c: Likewise. + * iconv/gconv_builtin.h: Likewise. + * iconv/gconv_conf.c: Likewise. + * iconv/gconv_int.h: Likewise. + * iconv/gconv_open.c: Likewise. + * iconv/gconv_simple.c: Likewise. + * iconv/iconv.c: Likewise. + * iconvdata/8bit-gap.c: Likewise. + * iconvdata/8bit-generic.c: Likewise. + * iconvdata/Makefile: Likewise. + * iconvdata/big5.c: Likewise. + * iconvdata/cns11643.c: Likewise. + * iconvdata/cns11643.h: Likewise. + * iconvdata/cns11643l1.c: Likewise. + * iconvdata/cns11643l1.h: Likewise. + * iconvdata/ebcdic-at-de-a.c: Likewise. + * iconvdata/ebcdic-at-de.c: Likewise. + * iconvdata/ebcdic-ca-fr.c: Likewise. + * iconvdata/euccn.c: Likewise. + * iconvdata/eucjp.c: Likewise. + * iconvdata/euckr.c: Likewise. + * iconvdata/euctw.c: Likewise. + * iconvdata/gb2312.c: Likewise. + * iconvdata/gb2312.h: Likewise. + * iconvdata/hp-roman8.c: Likewise. + * iconvdata/iso646.c: Likewise. + * iconvdata/iso6937.c: Likewise. + * iconvdata/iso8859-1.c: Likewise. + * iconvdata/iso8859-10.c: Likewise. + * iconvdata/iso8859-2.c: Likewise. + * iconvdata/iso8859-3.c: Likewise. + * iconvdata/iso8859-4.c: Likewise. + * iconvdata/iso8859-5.c: Likewise. + * iconvdata/iso8859-6.c: Likewise. + * iconvdata/iso8859-7.c: Likewise. + * iconvdata/iso8859-8.c: Likewise. + * iconvdata/iso8859-9.c: Likewise. + * iconvdata/jis0201.c: Likewise. + * iconvdata/jis0201.h: Likewise. + * iconvdata/jis0208.c: Likewise. + * iconvdata/jis0208.h: Likewise. + * iconvdata/jis0212.c: Likewise. + * iconvdata/jis0212.h: Likewise. + * iconvdata/johab.c: Likewise. + * iconvdata/koi-8.c: Likewise. + * iconvdata/koi8-r.c: Likewise. + * iconvdata/ksc5601.c: Likewise. + * iconvdata/ksc5601.h: Likewise. + * iconvdata/latin-greek-1.c: Likewise. + * iconvdata/latin-greek.c: Likewise. + * iconvdata/run-iconv-test.sh: Likewise. + * iconvdata/sjis.c: Likewise. + * iconvdata/t61.c: Likewise. + * iconvdata/uhc.c: Likewise. + * wcsmbs/btowc.c: Likewise. + * wcsmbs/mbrtowc.c: Likewise. + * wcsmbs/mbsnrtowcs.c: Likewise. + * wcsmbs/mbsrtowcs.c: Likewise. + * wcsmbs/wcrtomb.c: Likewise. + * wcsmbs/wcsmbsload.c: Likewise. + * wcsmbs/wcsnrtombs.c: Likewise. + * wcsmbs/wcsrtombs.c: Likewise. + * wcsmbs/wctob.c: Likewise. + * iconv/loop.c: New file. + * iconv/skeleton.c: New file. + + * stdlib/mblen.c: Handle empty input string correctly. + * stdlib/mbtowc.c: Likewise. + + * posix/getopt.c: Various cleanups. + + * sysdeps/arm/bits/setjmp.h: Add copyright text. + * sysdeps/i386/bits/setjmp.h: Likewise. + * sysdeps/m68k/bits/setjmp.h: Likewise. + * sysdeps/powerpc/bits/setjmp.h: Likewise. + * sysdeps/sparc/sparc32/bits/setjmp.h: Likewise. + + * sysdeps/generic/longjmp.c: Rename function to __libc_siglongjmp + and make longjmp weak alias. + +1998-04-18 20:29 Philip Blundell + + * iconv/Makefile (routines): Only include gconv_dl if building for + an ELF system - dynamic linking is not available on a.out. + (CFLAGS-gconv_conf.c): Define STATIC_GCONV if omitting gconv_dl + due to above check. + * iconv/gconv_db.c: If STATIC_GCONV defined, don't try to call + routines from gconv_dl. + +1998-04-17 Gordon Matzigkeit + + * csu/init.c (_IO_stdin_used): Protect with USE_IN_LIBIO so that + we can compile without libio. + +1998-04-20 16:28 Ulrich Drepper + + * sysdeps/mach/hurd/Subdirs: Remove login. + +1998-04-11 Gordon Matzigkeit + + * db2/compat.h: Include , to make sure we get the + definition of EFTYPE before we define it ourselves. + +1998-04-10 Gordon Matzigkeit + + * sysdeps/generic/bits/socket.h: Protect against multiple inclusion. + * sysdeps/mach/hurd/bits/ioctls.h: Likewise. + Fix typo to allow inclusion from sys/ioctl.h again. + +1998-04-16 Andreas Schwab + + * iconvdata/*.[ch]: Clean up namespace. Optimize character lookup. + +1998-04-16 Andreas Schwab + + * libc.map: Export __strerror_r. Remove _strerror_internal. + +1998-04-16 Andreas Schwab + + * sysdeps/generic/strcasestr.c: Undefine strcasestr, not strstr. + Also undefine __strcasestr. + +1998-04-16 Andreas Schwab + + * posix/regex.c: Rename __re_max_failures back to re_max_failures, + aliases do not work with global variables due to copy relocations. + +1998-04-20 15:12 Ulrich Drepper + + * manual/creature.texi: Fix type. Patch by Andreas Schwab. + +1998-04-20 13:47 Ulrich Drepper + + * signal/sighold.c: Include stddef.h for NULL definition. + * signal/sigrelse.c: Likewise. + * sysdeps/posix/sigignore.c: Likewise. + * sysdeps/posix/sigset.c: Likewise. + * sysdeps/posix/waitid.c: Likewise. + * sysdeps/unix/sysv/linux/rt_sigsuspend.c: Likewise. + * sysdeps/unix/sysv/linux/rt_sigtimedwait.c: Likewise. + * sysdeps/unix/sysv/linux/sigwaitinfo.c: Likewise. + * wcsmbs/mbsrtowcs.c: Include stdlib.h for MB_CUR_MAX. + Patch by Franz Sirl . + +1998-04-13 Mark Kettenis + + * login/Makefile (headers): Remove utmpx.h and bits/utmpx.h. + * login/getutent.c (getutxent): Remove alias. + * login/getutent_r.c (setutxent, pututxline, endutxent): + Remove aliases. + * login/getutid.c (getutxid): Remove alias. + * login/getutline.c (getutxline): Remove alias. + * login/utmp.h: Add prototypes for __updwtmp, __getutent, + __getutid, __getutline and __pututline. + * login/utmpx.h: Moved to ... + * sysdeps/gnu/utmpx.h: ... here. [__USE_GNU]: Define UTMPX_FILE, + UTMPX_FILENAME, WTMPX_FILE and WTMPX_FILENAME, declare utmpxname + and updwtmpx. + * login/updwtmp.c: Moved to ... + * sysdeps/generic/updwtmp.c: ... here. (updwtmp): Generalized by + allowing file name transformation. + * sysdeps/gnu/updwtmp.c: New file. Use generic implementation with + additional file name transformation. + * sysdeps/unix/sysv/linux/updwtmp.c: Likewise. + * login/utmp_file.c: Moved to ... + * sysdeps/generic/utmp_file.c: ... here. (setutent_file): + Generalized by allowing file name transformation. Do not + print error message. Library functions should not print them. + Reported by Jim Meyering. + * sysdeps/gnu/utmp_file.c: New file. Use generic implementation + with additional file name transformation. + * sysdeps/unix/sysv/linux/utmp_file.c: Likewise. + * sysdeps/gnu/Makefile [$(subdir)=login] (sysdep_routines): Add + setutxent, getutxent, endutxent, getutxid, getutxid, getutxline, + pututxline, utmpxname and updwtmpx. (sysdep_headers): Add utmpx.h + and bits/utmpx.h. + * sysdeps/gnu/bits/utmpx.h [__USE_GNU] Include paths.h. + (_PATH_UTMPX): Define to _PATH_UTMP. (_PATH_WTMPX): Define to + _PATH_WTMPX. (RUN_LVL): Define only if __USE_GNU. (ACCOUNTING): + Define if __USE_GNU. + * sysdeps/gnu/setutxent.c: New file. + * sysdeps/gnu/getutxent.c: New file. + * sysdeps/gnu/endutxent.c: New file. + * sysdeps/gnu/getutxid.c: New file. + * sysdeps/gnu/getutxline.c: New file. + * sysdeps/gnu/pututxline.c: New file. + * sysdeps/gnu/utmpxname.c: New file. + * sysdeps/gnu/updwtmpx.c: New file. + * sysdeps/unix/sysv/linux/paths.h (_PATH_UTMP_DB): Remove. + * sysdeps/generic/bits/utmpx.h: Remove. + +1998-04-20 Ulrich Drepper + + * posix/wordexp-test.c (main): Initialize ifs element of ts for + ~root test. + +1998-04-17 07:53 H.J. Lu + + * sysdeps/unix/sysv/linux/i386/s_pread64.S: Fix a typo. + +1998-04-17 11:32 Ulrich Drepper + + * libio/oldfileops.c (_IO_old_file_seekoff): Define temporary st + variable using _G_stat64. + * libio/fileops.c: Remove macro definition of fstat, it is in the + global header. + Reported by Thorsten Kukuk . + +1998-04-17 Philip Blundell + + * sysdeps/arm/strlen.S: New file, based on code by Matthew Wilcox + . + +1998-04-16 Philip Blundell + + * inet/netinet/in.h (IN6_IS_ADDR_MC_NODELOCAL): New macro, + required by IPv6 Basic API. + (IN6_IS_ADDR_MC_LINKLOCAL): Likewise. + (IN6_IS_ADDR_MC_SITELOCAL): Likewise. + (IN6_IS_ADDR_MC_ORGLOCAL): Likewise. + (IN6_IS_ADDR_MC_GLOBAL): Likewise. + 1998-04-15 16:41 Ulrich Drepper Don't name internal representation since it might be different from diff --git a/FAQ b/FAQ index 6eb4ff0fef..ed4658149c 100644 --- a/FAQ +++ b/FAQ @@ -24,7 +24,7 @@ please let me know. 1.3. When I try to compile glibc I get only error messages. What's wrong? 1.4. Do I need a special linker or archiver? -1.5. What tools do I need for powerpc? +1.5. Which compiler should I use for powerpc? 1.6. Do I need some more things to compile GNU C Library? 1.7. What version of the Linux kernel headers should be used? 1.8. When I run `nm -u libc.so' on the produced library I still @@ -203,25 +203,19 @@ may have native linker support, but it's moot right now, because glibc has not been ported to them. -1.5. What tools do I need for powerpc? +1.5. Which compiler should I use for powerpc? -{GK} For a successful installation you definitely need the most recent -tools. You can safely assume that anything earlier than binutils -2.8.1.0.17 and egcs-1.0 will have problems. We'd advise at the moment -binutils 2.8.1.0.18 and egcs-1.0.1. +{GK} You want to use egcs 1.0.1 or later (together with the right +versions of all the other tools, of course). -In fact, egcs 1.0.1 currently has two serious bugs that prevent a -clean make; one relates to switch statement folding, for which there -is a temporary patch at +In fact, egcs 1.0.1 has a serious bug that prevents a clean make, +relating to switch statement folding. It also causes the resulting +shared libraries to use more memory than they should. There is a +patch at: - + -and the other relates to 'forbidden register spilled', for which the -workaround is to put - -CFLAGS-condvar.c += -fno-inline - -in configparms. Later versions of egcs may fix these problems. +Later versions of egcs may fix these problems. 1.6. Do I need some more things to compile GNU C Library? @@ -247,7 +241,8 @@ in configparms. Later versions of egcs may fix these problems. * When compiling for Linux, the header files of the Linux kernel must be available to the compiler as and . -* lots of disk space (~170MB for i?86-linux; more for RISC platforms). +* lots of disk space (~170MB for i?86-linux; more for RISC platforms, + as much as 400MB). * plenty of time. Compiling just the shared and static libraries for i?86-linux takes approximately 1h on an i586@133, or 2.5h on @@ -290,9 +285,6 @@ symbols: * symbols starting with _dl_* come from the dynamic linker -* symbols resolved by using libgcc.a - (__udivdi3, __umoddi3, or similar) - * weak symbols, which need not be resolved at all (fabs for example) Generally, you should make sure you find a real program which produces @@ -1141,7 +1133,7 @@ Answers were given by: {MK} Mark Kettenis, {ZW} Zack Weinberg, {TK} Thorsten Kukuk, -{GK} Geoffrey Keating, +{GK} Geoffrey Keating, {HJ} H.J. Lu, Local Variables: diff --git a/FAQ.in b/FAQ.in index 7ca0218ec6..0a8277fbe2 100644 --- a/FAQ.in +++ b/FAQ.in @@ -89,25 +89,19 @@ required. For Linux, get binutils-2.8.1.0.23 or later. Other systems may have native linker support, but it's moot right now, because glibc has not been ported to them. -??powerpc What tools do I need for powerpc? +??powerpc Which compiler should I use for powerpc? -{GK} For a successful installation you definitely need the most recent -tools. You can safely assume that anything earlier than binutils -2.8.1.0.17 and egcs-1.0 will have problems. We'd advise at the moment -binutils 2.8.1.0.18 and egcs-1.0.1. +{GK} You want to use egcs 1.0.1 or later (together with the right +versions of all the other tools, of course). -In fact, egcs 1.0.1 currently has two serious bugs that prevent a -clean make; one relates to switch statement folding, for which there -is a temporary patch at +In fact, egcs 1.0.1 has a serious bug that prevents a clean make, +relating to switch statement folding. It also causes the resulting +shared libraries to use more memory than they should. There is a +patch at: - + -and the other relates to 'forbidden register spilled', for which the -workaround is to put - -CFLAGS-condvar.c += -fno-inline - -in configparms. Later versions of egcs may fix these problems. +Later versions of egcs may fix these problems. ?? Do I need some more things to compile GNU C Library? @@ -133,7 +127,8 @@ in configparms. Later versions of egcs may fix these problems. * When compiling for Linux, the header files of the Linux kernel must be available to the compiler as and . -* lots of disk space (~170MB for i?86-linux; more for RISC platforms). +* lots of disk space (~170MB for i?86-linux; more for RISC platforms, + as much as 400MB). * plenty of time. Compiling just the shared and static libraries for i?86-linux takes approximately 1h on an i586@133, or 2.5h on @@ -174,9 +169,6 @@ symbols: * symbols starting with _dl_* come from the dynamic linker -* symbols resolved by using libgcc.a - (__udivdi3, __umoddi3, or similar) - * weak symbols, which need not be resolved at all (fabs for example) Generally, you should make sure you find a real program which produces @@ -981,7 +973,7 @@ Answers were given by: {MK} Mark Kettenis, {ZW} Zack Weinberg, {TK} Thorsten Kukuk, -{GK} Geoffrey Keating, +{GK} Geoffrey Keating, {HJ} H.J. Lu, Local Variables: diff --git a/bits/socket.h b/bits/socket.h index 5dc1e65370..01844bc143 100644 --- a/bits/socket.h +++ b/bits/socket.h @@ -17,6 +17,9 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef __BITS_SOCKET_H +#define __BITS_SOCKET_H 1 + #if !defined _SYS_SOCKET_H && !defined _NETINET_IN_H # error "Never include directly; use instead." #endif @@ -196,3 +199,5 @@ struct linger int l_onoff; /* Nonzero to linger on close. */ int l_linger; /* Time to linger. */ }; + +#endif /* bits/socket.h */ diff --git a/csu/init.c b/csu/init.c index 2b7a2ef0ff..df08f6c918 100644 --- a/csu/init.c +++ b/csu/init.c @@ -1,5 +1,5 @@ /* Special startup support. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it @@ -26,7 +26,7 @@ write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#if defined __GNUC__ && __GNUC__ >= 2 +#if defined USE_IN_LIBIO && defined __GNUC__ && __GNUC__ >= 2 #undef _LIBC #include diff --git a/db2/compat.h b/db2/compat.h index 8652ad97ec..86909aeb13 100644 --- a/db2/compat.h +++ b/db2/compat.h @@ -1,6 +1,7 @@ /* Compatibility gunk for the db library. */ #include +#include #ifndef EFTYPE # define EFTYPE EINVAL diff --git a/elf/dl-minimal.c b/elf/dl-minimal.c index b0c8c465e4..70b5aeeeac 100644 --- a/elf/dl-minimal.c +++ b/elf/dl-minimal.c @@ -193,12 +193,15 @@ __assert_perror_fail (int errnum, const char *file, unsigned int line, const char *function) { + char errbuf[64]; char buf[64]; buf[sizeof buf - 1] = '\0'; _dl_sysdep_fatal ("BUG IN DYNAMIC LINKER ld.so: ", file, ": ", _itoa_word (line, buf + sizeof buf - 1, 10, 0), ": ", function ?: "", function ? ": " : "", - "Unexpected error: ", strerror (errnum), "\n", NULL); + "Unexpected error: ", + __strerror_r (errnum, errbuf, sizeof (errbuf)), "\n", + NULL); } diff --git a/iconv/Makefile b/iconv/Makefile index 783b1d55b5..e4cd0fc53d 100644 --- a/iconv/Makefile +++ b/iconv/Makefile @@ -21,10 +21,18 @@ # subdir := iconv +include ../Makeconfig + headers = iconv.h gconv.h routines = iconv_open iconv iconv_close \ gconv_open gconv gconv_close gconv_db gconv_conf \ - gconv_dl gconv_builtin gconv_simple + gconv_builtin gconv_simple +ifeq ($(elf),yes) +routines += gconv_dl +else +CFLAGS-gconv_db.c = -DSTATIC_GCONV +endif + distribute = gconv_builtin.h gconv_int.h others = iconv_prog diff --git a/iconv/gconv.c b/iconv/gconv.c index f8b7c8050d..aa58bdba7d 100644 --- a/iconv/gconv.c +++ b/iconv/gconv.c @@ -19,39 +19,58 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include #include +#include int internal_function -__gconv (gconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, - size_t *outbytesleft, size_t *converted) +__gconv (gconv_t cd, const char **inbuf, const char *inbufend, char **outbuf, + char *outbufend, size_t *converted) { size_t last_step = cd->nsteps - 1; - size_t oldinbytes = *inbytesleft; int result; if (cd == (gconv_t) -1L) return GCONV_ILLEGAL_DESCRIPTOR; - cd->data[last_step].outbuf = outbuf ? *outbuf : NULL; - cd->data[last_step].outbufavail = 0; - cd->data[last_step].outbufsize = *outbytesleft; + assert (converted != NULL); + *converted = 0; - if (converted != NULL) - *converted = 0; + if (inbuf == NULL || *inbuf == NULL) + /* We just flush. */ + result = (*cd->steps->fct) (cd->steps, cd->data, NULL, NULL, converted, 1); + else + { + const char *last_start; - result = (*cd->steps->fct) (cd->steps, cd->data, - inbuf ? *inbuf : NULL, inbytesleft, - converted, inbuf == NULL || *inbuf == NULL); + assert (outbuf != NULL && *outbuf != NULL); + cd->data[last_step].outbuf = *outbuf; + cd->data[last_step].outbufend = outbufend; - if (inbuf != NULL && *inbuf != NULL) - *inbuf += oldinbytes - *inbytesleft; - if (outbuf != NULL && *outbuf != NULL) - { - *outbuf += cd->data[last_step].outbufavail; - *outbytesleft -= cd->data[last_step].outbufavail; + do + { + /* See whether the input size is reasoable for the output + size. If not adjust it. */ + size_t inlen = ((inbufend - *inbuf) / cd->steps->max_needed_from + * cd->steps->max_needed_from); + + if (cd->nsteps > 1) + inlen = MIN (inlen, (((outbufend - cd->data[last_step].outbuf) + / cd->steps[last_step].max_needed_to) + * cd->steps[last_step].max_needed_to)); + + last_start = *inbuf; + result = (*cd->steps->fct) (cd->steps, cd->data, inbuf, + *inbuf + inlen, converted, 0); + } + while (result == GCONV_EMPTY_INPUT && last_start != *inbuf + && *inbuf + cd->steps->min_needed_from <= inbufend); } + if (outbuf != NULL && *outbuf != NULL) + *outbuf = cd->data[last_step].outbuf; + return result; } diff --git a/iconv/gconv.h b/iconv/gconv.h index f3f80f4c14..cd0e3de1dc 100644 --- a/iconv/gconv.h +++ b/iconv/gconv.h @@ -57,8 +57,8 @@ struct gconv_loaded_object; /* Type of a conversion function. */ typedef int (*gconv_fct) __P ((struct gconv_step *, - struct gconv_step_data *, - __const char *, size_t *, size_t *, int)); + struct gconv_step_data *, __const char **, + __const char *, size_t *, int)); /* Constructor and destructor for local data for conversion step. */ typedef int (*gconv_init_fct) __P ((struct gconv_step *)); @@ -80,6 +80,13 @@ struct gconv_step gconv_init_fct init_fct; gconv_end_fct end_fct; + /* Information about the number of bytes needed or produced in this + step. This helps optimizing the buffer sizes. */ + int min_needed_from; + int max_needed_from; + int min_needed_to; + int max_needed_to; + void *data; /* Pointer to step-local data. */ }; @@ -88,8 +95,7 @@ struct gconv_step struct gconv_step_data { char *outbuf; /* Output buffer for this step. */ - size_t outbufavail; /* Bytes already available in output buffer. */ - size_t outbufsize; /* Size of output buffer. */ + char *outbufend; /* Address of first byte after the output buffer. */ int is_last; diff --git a/iconv/gconv_builtin.c b/iconv/gconv_builtin.c index 6b14804da3..a970fcc8f2 100644 --- a/iconv/gconv_builtin.c +++ b/iconv/gconv_builtin.c @@ -33,15 +33,25 @@ static struct builtin_map gconv_init_fct init; gconv_end_fct end; + int min_needed_from; + int max_needed_from; + int min_needed_to; + int max_needed_to; + } map[] = { #define BUILTIN_TRANSFORMATION(From, ConstPfx, ConstLen, To, Cost, Name, \ - Fct, Init, End) \ + Fct, Init, End, MinF, MaxF, MinT, MaxT) \ { \ name: Name, \ fct: Fct, \ init: Init, \ end: End, \ + \ + min_needed_from: MinF, \ + max_needed_from: MaxF, \ + min_needed_to: MinT, \ + max_needed_to: MaxT \ }, #define BUILTIN_ALIAS(From, To) @@ -66,4 +76,9 @@ __gconv_get_builtin_trans (const char *name, struct gconv_step *step) step->end_fct = map[cnt].end; step->counter = INT_MAX; step->shlib_handle = NULL; + + step->min_needed_from = map[cnt].min_needed_from; + step->max_needed_from = map[cnt].max_needed_from; + step->min_needed_to = map[cnt].min_needed_to; + step->max_needed_to = map[cnt].max_needed_to; } diff --git a/iconv/gconv_builtin.h b/iconv/gconv_builtin.h index 265dca1f01..3d214ff4f0 100644 --- a/iconv/gconv_builtin.h +++ b/iconv/gconv_builtin.h @@ -26,10 +26,12 @@ BUILTIN_ALIAS ("10646-1:1993/UCS4/", "ISO-10646/UCS4/") BUILTIN_TRANSFORMATION (NULL, "INTERNAL", 8, "ISO-10646/UCS4/", 1, "=INTERNAL->ucs4", - __gconv_transform_internal_ucs4, NULL, NULL) + __gconv_transform_internal_ucs4, NULL, NULL, + 4, 4, 4, 4) BUILTIN_TRANSFORMATION (NULL, "ISO-10646/UCS4/", 15, "INTERNAL", 1, "=ucs4->INTERNAL", - __gconv_transform_internal_ucs4, NULL, NULL) + __gconv_transform_internal_ucs4, NULL, NULL, + 4, 4, 4, 4) /* Please note that we need only one function for both direction. */ BUILTIN_ALIAS ("UTF8//", "ISO-10646/UTF8/") @@ -37,22 +39,27 @@ BUILTIN_ALIAS ("UTF-8//", "ISO-10646/UTF8/") BUILTIN_TRANSFORMATION (NULL, "INTERNAL", 8, "ISO-10646/UTF8/", 1, "=INTERNAL->utf8", - __gconv_transform_internal_utf8, NULL, NULL) + __gconv_transform_internal_utf8, NULL, NULL, + 4, 4, 1, 6) BUILTIN_TRANSFORMATION ("ISO-10646/UTF-?8/", "ISO-10646/UTF", 13, "INTERNAL", 1, "=utf8->INTERNAL", - __gconv_transform_utf8_internal, NULL, NULL) + __gconv_transform_utf8_internal, NULL, NULL, + 1, 6, 4, 4) BUILTIN_ALIAS ("UCS2//", "ISO-10646/UCS2/") BUILTIN_ALIAS ("UCS-2//", "ISO-10646/UCS2/") BUILTIN_TRANSFORMATION (NULL, "ISO-10646/UCS2/", 15, "INTERNAL", 1, "=ucs2->INTERNAL", - __gconv_transform_ucs2_internal, NULL, NULL) + __gconv_transform_ucs2_internal, NULL, NULL, + 2, 2, 4, 4) BUILTIN_TRANSFORMATION (NULL, "INTERNAL", 8, "ISO-10646/UCS2/", 1, "=INTERNAL->ucs2", - __gconv_transform_internal_ucs2, NULL, NULL) + __gconv_transform_internal_ucs2, NULL, NULL, + 4, 4, 2, 2) BUILTIN_TRANSFORMATION ("(.*)", NULL, 0, "\\1", 1, "=dummy", - __gconv_transform_dummy, NULL, NULL) + __gconv_transform_dummy, NULL, NULL, + 1, 1, 1, 1) diff --git a/iconv/gconv_conf.c b/iconv/gconv_conf.c index c67a0d8f8c..ae5ba19e5d 100644 --- a/iconv/gconv_conf.c +++ b/iconv/gconv_conf.c @@ -47,7 +47,7 @@ static const char gconv_module_ext[] = MODULE_EXT; static struct gconv_module builtin_modules[] = { #define BUILTIN_TRANSFORMATION(From, ConstPfx, ConstLen, To, Cost, Name, \ - Fct, Init, End) \ + Fct, Init, End, MinF, MaxF, MinT, MaxT) \ { \ from_pattern: From, \ from_constpfx: ConstPfx, \ @@ -69,7 +69,7 @@ static const char * builtin_aliases[] = { #define BUILTIN_TRANSFORMATION(From, ConstPfx, ConstLen, To, Cost, Name, \ - Fct, Init, End) + Fct, Init, End, MinF, MaxF, MinT, MaxT) #define BUILTIN_ALIAS(From, To) From " " To, #include "gconv_builtin.h" diff --git a/iconv/gconv_db.c b/iconv/gconv_db.c index 9f4366b7df..62d8f0540c 100644 --- a/iconv/gconv_db.c +++ b/iconv/gconv_db.c @@ -192,6 +192,7 @@ gen_steps (struct derivation_step *best, const char *toset, ? __strdup (current->result_set) : result[step_cnt + 1].from_name); +#ifndef STATIC_GCONV if (current->code->module_name[0] == '/') { /* Load the module, return handle for it. */ @@ -212,6 +213,7 @@ gen_steps (struct derivation_step *best, const char *toset, result[step_cnt].end_fct = shlib_handle->end_fct; } else +#endif /* It's a builtin transformation. */ __gconv_get_builtin_trans (current->code->module_name, &result[step_cnt]); @@ -230,7 +232,9 @@ gen_steps (struct derivation_step *best, const char *toset, { if (result[step_cnt].end_fct != NULL) (*result[step_cnt].end_fct) (&result[step_cnt]); +#ifndef STATIC_GCONV __gconv_release_shlib (result[step_cnt].shlib_handle); +#endif } free (result); *nsteps = 0; @@ -525,6 +529,7 @@ __gconv_find_transform (const char *toset, const char *fromset, result = find_derivation (toset, toset_expand, fromset, fromset_expand, handle, nsteps); +#ifndef STATIC_GCONV /* Increment the user counter. */ if (result == GCONV_OK) { @@ -548,6 +553,7 @@ __gconv_find_transform (const char *toset, const char *fromset, } while (cnt > 0); } +#endif /* Release the lock. */ __libc_lock_unlock (lock); @@ -568,6 +574,7 @@ __gconv_close_transform (struct gconv_step *steps, size_t nsteps) { int result = GCONV_OK; +#ifndef STATIC_GCONV /* Acquire the lock. */ __libc_lock_lock (lock); @@ -583,6 +590,7 @@ __gconv_close_transform (struct gconv_step *steps, size_t nsteps) /* Release the lock. */ __libc_lock_unlock (lock); +#endif return result; } diff --git a/iconv/gconv_int.h b/iconv/gconv_int.h index a1475f8508..86e892f874 100644 --- a/iconv/gconv_int.h +++ b/iconv/gconv_int.h @@ -34,8 +34,8 @@ struct gconv_alias }; -/* Default size of intermediate buffers. */ -#define GCONV_DEFAULT_BUFSIZE 8160 +/* How many character should be conveted in one call? */ +#define GCONV_NCHAR_GOAL 8160 /* Structure describing one loaded shared object. This normally are @@ -99,9 +99,8 @@ extern int __gconv_close (gconv_t cd) according to rules described by CD and place up to *OUTBYTESLEFT bytes in buffer starting at *OUTBUF. Return number of written characters in *CONVERTED if this pointer is not null. */ -extern int __gconv (gconv_t __cd, const char **__inbuf, size_t *__inbytesleft, - char **__outbuf, size_t *__outbytesleft, - size_t *__converted) +extern int __gconv (gconv_t __cd, const char **__inbuf, const char *inbufend, + char **__outbuf, char *outbufend, size_t *__converted) internal_function; /* Return in *HANDLE a pointer to an array with *NSTEPS elements describing @@ -149,8 +148,8 @@ extern void __gconv_get_builtin_trans (const char *__name, #ifdef _LIBC # define __BUILTIN_TRANS(Name) \ extern int Name (struct gconv_step *__step, struct gconv_step_data *__data, \ - const char *__inbuf, size_t *__inlen, size_t *__written, \ - int __do_flush) + const char **__inbuf, const char *__inbufend, \ + size_t *__written, int __do_flush) __BUILTIN_TRANS (__gconv_transform_dummy); __BUILTIN_TRANS (__gconv_transform_ascii_internal); diff --git a/iconv/gconv_open.c b/iconv/gconv_open.c index d82dcfee48..831794fc22 100644 --- a/iconv/gconv_open.c +++ b/iconv/gconv_open.c @@ -62,21 +62,24 @@ __gconv_open (const char *toset, const char *fromset, gconv_t *handle) for (cnt = 0; cnt < nsteps; ++cnt) { /* If this is the last step we must not allocate an output - buffer. Signal this to the initializer. */ + buffer. */ data[cnt].is_last = cnt == nsteps - 1; /* We use the `mbstate_t' member in DATA. */ data[cnt].statep = &data[cnt].__state; /* Allocate the buffer. */ - data[cnt].outbufsize = GCONV_DEFAULT_BUFSIZE; - data[cnt].outbuf = (char *) malloc (data[cnt].outbufsize); - if (data[cnt].outbuf == NULL) + if (!data[cnt].is_last) { - res = GCONV_NOMEM; - break; + data[cnt].outbuf = + (char *) malloc (GCONV_NCHAR_GOAL + * steps[cnt].max_needed_to); + if (data[cnt].outbuf == NULL) + { + res = GCONV_NOMEM; + break; + } } - data[cnt].outbufavail = 0; } } } diff --git a/iconv/gconv_simple.c b/iconv/gconv_simple.c index b72e61edcc..f2fec12fb8 100644 --- a/iconv/gconv_simple.c +++ b/iconv/gconv_simple.c @@ -35,7 +35,7 @@ /* These are definitions used by some of the functions for handling UTF-8 encoding below. */ -static const wchar_t encoding_mask[] = +static const uint32_t encoding_mask[] = { ~0x7ff, ~0xffff, ~0x1fffff, ~0x3ffffff }; @@ -49,8 +49,8 @@ static const unsigned char encoding_byte[] = int __gconv_transform_dummy (struct gconv_step *step, struct gconv_step_data *data, - const char *inbuf, size_t *inlen, size_t *written, - int do_flush) + const char **inbuf, const char *inbufend, + size_t *written, int do_flush) { size_t do_write; @@ -60,12 +60,12 @@ __gconv_transform_dummy (struct gconv_step *step, struct gconv_step_data *data, do_write = 0; else { - do_write = MIN (*inlen, data->outbufsize - data->outbufavail); + do_write = MIN (inbufend - *inbuf, data->outbufend - data->outbuf); memcpy (data->outbuf, inbuf, do_write); - *inlen -= do_write; - data->outbufavail += do_write; + *inbuf -= do_write; + *data->outbuf += do_write; } /* ### TODO Actually, this number must be devided according to the @@ -83,934 +83,330 @@ __gconv_transform_dummy (struct gconv_step *step, struct gconv_step_data *data, format is, if any, the endianess. The Unicode/ISO 10646 says that unless some higher protocol specifies it differently, the byte order is big endian.*/ -int -__gconv_transform_internal_ucs4 (struct gconv_step *step, - struct gconv_step_data *data, - const char *inbuf, size_t *inlen, - size_t *written, int do_flush) +#define DEFINE_INIT 0 +#define DEFINE_FINI 0 +#define MIN_NEEDED_FROM 4 +#define MIN_NEEDED_TO 4 +#define FROM_DIRECTION 1 +#define FROM_LOOP internal_ucs4_loop +#define TO_LOOP internal_ucs4_loop /* This is not used. */ +#define FUNCTION_NAME __gconv_transform_internal_ucs4 + + +static inline int +internal_ucs4_loop (const unsigned char **inptrp, const unsigned char *inend, + unsigned char **outptrp, unsigned char *outend, + mbstate_t *state, void *data, size_t *converted) { - struct gconv_step *next_step = step + 1; - struct gconv_step_data *next_data = data + 1; - gconv_fct fct = next_step->fct; - size_t do_write = 0; + const unsigned char *inptr = *inptrp; + unsigned char *outptr = *outptrp; + size_t n_convert = MIN (inend - inptr, outend - outptr) / 4; int result; - /* If the function is called with no input this means we have to reset - to the initial state. The possibly partly converted input is - dropped. */ - if (do_flush) - { - /* Clear the state. */ - memset (data->statep, '\0', sizeof (mbstate_t)); - - /* Call the steps down the chain if there are any. */ - if (data->is_last) - result = GCONV_OK; - else - { - struct gconv_step *next_step = step + 1; - struct gconv_step_data *next_data = data + 1; - - result = (*fct) (next_step, next_data, NULL, 0, written, 1); - - /* Clear output buffer. */ - data->outbufavail = 0; - } - } - else - { - int save_errno = errno; - - result = GCONV_OK; - do - { - size_t n_convert = (MIN (*inlen, - (data->outbufsize - data->outbufavail)) - / sizeof (wchar_t)); - #if __BYTE_ORDER == __LITTLE_ENDIAN - /* Sigh, we have to do some real work. */ - wchar_t *outbuf = (wchar_t *) &data->outbuf[data->outbufavail]; - size_t cnt; + /* Sigh, we have to do some real work. */ + size_t cnt; - for (cnt = 0; cnt < n_convert; ++cnt) - outbuf[cnt] = bswap_32 (((wchar_t *) inbuf)[cnt]); + for (cnt = 0; cnt < n_convert; ++cnt) + *((uint32_t *) outptr)++ = bswap_32 (*((uint32_t *) inptr)++); + *inptrp = inptr; + *outptrp = outptr; #elif __BYTE_ORDER == __BIG_ENDIAN - /* Simply copy the data. */ - memcpy (&data->outbuf[data->outbufsize], inbuf, - n_convert * sizeof (wchar_t)); + /* Simply copy the data. */ + *inptrp = inptr + n_convert * 4; + *outptrp = __mempcpy (outptr, inptr, n_convert * 4); #else # error "This endianess is not supported." #endif - *inlen -= n_convert * sizeof (wchar_t); - inbuf += n_convert * sizeof (wchar_t); - data->outbufavail += n_convert * sizeof (wchar_t); - do_write += n_convert; - - if (*inlen > 0 && *inlen < sizeof (wchar_t)) - { - /* We have an incomplete character at the end. */ - result = GCONV_INCOMPLETE_INPUT; - break; - } - - if (data->is_last) - { - /* This is the last step. */ - result = (*inlen < sizeof (wchar_t) - ? GCONV_EMPTY_INPUT : GCONV_FULL_OUTPUT); - break; - } - - /* Status so far. */ - result = GCONV_EMPTY_INPUT; - - if (data->outbufavail > 0) - { - /* Call the functions below in the chain. */ - size_t newavail = data->outbufavail; - - result = (*fct) (next_step, next_data, data->outbuf, &newavail, - written, 0); - - /* Correct the output buffer. */ - if (newavail != data->outbufavail && newavail > 0) - { - memmove (data->outbuf, - &data->outbuf[data->outbufavail - newavail], - newavail); - data->outbufavail = newavail; - } - } - } - while (*inlen >= sizeof (wchar_t) && result == GCONV_EMPTY_INPUT); - - __set_errno (save_errno); - } - - if (written != NULL && data->is_last) - *written = do_write; - - return result; -} - - -/* Convert from ISO 646-IRV to the internal (UCS4-like) format. */ -int -__gconv_transform_ascii_internal (struct gconv_step *step, - struct gconv_step_data *data, - const char *inbuf, size_t *inlen, - size_t *written, int do_flush) -{ - struct gconv_step *next_step = step + 1; - struct gconv_step_data *next_data = data + 1; - gconv_fct fct = next_step->fct; - size_t do_write = 0; - int result; - - /* If the function is called with no input this means we have to reset - to the initial state. The possibly partly converted input is - dropped. */ - if (do_flush) - { - /* Clear the state. */ - memset (data->statep, '\0', sizeof (mbstate_t)); - - /* Call the steps down the chain if there are any. */ - if (data->is_last) - result = GCONV_OK; - else - { - struct gconv_step *next_step = step + 1; - struct gconv_step_data *next_data = data + 1; - - result = (*fct) (next_step, next_data, NULL, 0, written, 1); - - /* Clear output buffer. */ - data->outbufavail = 0; - } - } - else - { - const unsigned char *newinbuf = inbuf; - int save_errno = errno; - - result = GCONV_OK; - do - { - size_t actually = 0; - size_t cnt = 0; - - while (data->outbufavail + sizeof (wchar_t) <= data->outbufsize - && cnt < *inlen) - { - if (*newinbuf > '\x7f') - { - /* This is no correct ANSI_X3.4-1968 character. */ - result = GCONV_ILLEGAL_INPUT; - break; - } - - /* It's an one byte sequence. */ - *(wchar_t *) &data->outbuf[data->outbufavail] - = (wchar_t) *newinbuf; - data->outbufavail += sizeof (wchar_t); - ++actually; - - ++newinbuf; - ++cnt; - } - - /* Remember how much we converted. */ - do_write += cnt * sizeof (wchar_t); - *inlen -= cnt; - - /* Check whether an illegal character appeared. */ - if (result != GCONV_OK) - break; - - if (data->is_last) - { - /* This is the last step. */ - result = (*inlen == 0 ? GCONV_EMPTY_INPUT : GCONV_FULL_OUTPUT); - break; - } - - /* Status so far. */ - result = GCONV_EMPTY_INPUT; - - if (data->outbufavail > 0) - { - /* Call the functions below in the chain. */ - size_t newavail = data->outbufavail; - - result = (*fct) (next_step, next_data, data->outbuf, &newavail, - written, 0); - - /* Correct the output buffer. */ - if (newavail != data->outbufavail && newavail > 0) - { - memmove (data->outbuf, - &data->outbuf[data->outbufavail - newavail], - newavail); - data->outbufavail = newavail; - } - } - } - while (*inlen > 0 && result == GCONV_EMPTY_INPUT); - - __set_errno (save_errno); - } - - if (written != NULL && data->is_last) - *written = do_write / sizeof (wchar_t); - - return result; -} - - -/* Convert from ISO 10646/UCS to ISO 646-IRV. */ -int -__gconv_transform_internal_ascii (struct gconv_step *step, - struct gconv_step_data *data, - const char *inbuf, size_t *inlen, - size_t *written, int do_flush) -{ - struct gconv_step *next_step = step + 1; - struct gconv_step_data *next_data = data + 1; - gconv_fct fct = next_step->fct; - size_t do_write; - int result; - - /* If the function is called with no input this means we have to reset - to the initial state. The possibly partly converted input is - dropped. */ - if (do_flush) - { - /* Clear the state. */ - memset (data->statep, '\0', sizeof (mbstate_t)); - do_write = 0; - - /* Call the steps down the chain if there are any. */ - if (data->is_last) - result = GCONV_OK; - else - { - struct gconv_step *next_step = step + 1; - struct gconv_step_data *next_data = data + 1; - - result = (*fct) (next_step, next_data, NULL, 0, written, 1); - - /* Clear output buffer. */ - data->outbufavail = 0; - } - } - else - { - const wchar_t *newinbuf = (const wchar_t *) inbuf; - int save_errno = errno; - do_write = 0; - - result = GCONV_OK; - do - { - size_t actually = 0; - size_t cnt = 0; - - while (data->outbufavail < data->outbufsize - && cnt + 3 < *inlen) - { - if (*newinbuf < L'\0' || *newinbuf > L'\x7f') - { - /* This is no correct ANSI_X3.4-1968 character. */ - result = GCONV_ILLEGAL_INPUT; - break; - } - - /* It's an one byte sequence. */ - data->outbuf[data->outbufavail++] = (char) *newinbuf; - ++actually; - - ++newinbuf; - cnt += sizeof (wchar_t); - } - - /* Remember how much we converted. */ - do_write += cnt / sizeof (wchar_t); - *inlen -= cnt; - - /* Check whether an illegal character appeared. */ - if (result != GCONV_OK) - break; - - /* Check for incomplete input. */ - if (*inlen > 0 && *inlen < sizeof (wchar_t)) - { - /* We have an incomplete character at the end. */ - result = GCONV_INCOMPLETE_INPUT; - break; - } - - if (data->is_last) - { - /* This is the last step. */ - result = *inlen == 0 ? GCONV_EMPTY_INPUT : GCONV_FULL_OUTPUT; - break; - } - - /* Status so far. */ - result = GCONV_EMPTY_INPUT; - - if (data->outbufavail > 0) - { - /* Call the functions below in the chain. */ - size_t newavail = data->outbufavail; - - result = (*fct) (next_step, next_data, data->outbuf, &newavail, - written, 0); - - /* Correct the output buffer. */ - if (newavail != data->outbufavail && newavail > 0) - { - memmove (data->outbuf, - &data->outbuf[data->outbufavail - newavail], - newavail); - data->outbufavail = newavail; - } - } - } - while (*inlen > 0 && result == GCONV_EMPTY_INPUT); - - __set_errno (save_errno); - } - - if (written != NULL && data->is_last) - *written = do_write; - - return result; -} - - -int -__gconv_transform_internal_utf8 (struct gconv_step *step, - struct gconv_step_data *data, - const char *inbuf, size_t *inlen, - size_t *written, int do_flush) -{ - struct gconv_step *next_step = step + 1; - struct gconv_step_data *next_data = data + 1; - gconv_fct fct = next_step->fct; - size_t do_write; - int result; - - /* If the function is called with no input this means we have to reset - to the initial state. The possibly partly converted input is - dropped. */ - if (do_flush) - { - /* Clear the state. */ - memset (data->statep, '\0', sizeof (mbstate_t)); - do_write = 0; - - /* Call the steps down the chain if there are any. */ - if (data->is_last) - result = GCONV_OK; - else - { - struct gconv_step *next_step = step + 1; - struct gconv_step_data *next_data = data + 1; - - result = (*fct) (next_step, next_data, NULL, 0, written, 1); - - /* Clear output buffer. */ - data->outbufavail = 0; - } - } - else - { - const wchar_t *newinbuf = (const wchar_t *) inbuf; - int save_errno = errno; - do_write = 0; - - result = GCONV_OK; - do - { - size_t cnt = 0; - - while (data->outbufavail < data->outbufsize - && cnt * sizeof (wchar_t) + 3 < *inlen) - { - wchar_t wc = newinbuf[cnt]; - - if (wc < 0 && wc > 0x7fffffff) - { - /* This is no correct ISO 10646 character. */ - result = GCONV_ILLEGAL_INPUT; - break; - } - - if (wc < 0x80) - /* It's an one byte sequence. */ - data->outbuf[data->outbufavail++] = (char) wc; - else - { - size_t step; - size_t start; - - for (step = 2; step < 6; ++step) - if ((wc & encoding_mask[step - 2]) == 0) - break; - - if (data->outbufavail + step >= data->outbufsize) - /* Too long. */ - break; - - start = data->outbufavail; - data->outbufavail += step; - data->outbuf[start] = encoding_byte[step - 2]; - --step; - do - { - data->outbuf[start + step] = 0x80 | (wc & 0x3f); - wc >>= 6; - } - while (--step > 0); - data->outbuf[start] |= wc; - } - - ++cnt; - } - - /* Remember how much we converted. */ - do_write += cnt; - *inlen -= cnt * sizeof (wchar_t); - newinbuf += cnt; - - /* Check whether an illegal character appeared. */ - if (result != GCONV_OK) - break; - - /* Check for incomplete input. */ - if (*inlen > 0 && *inlen < sizeof (wchar_t)) - { - /* We have an incomplete character at the end. */ - result = GCONV_INCOMPLETE_INPUT; - break; - } - - if (data->is_last) - { - /* This is the last step. */ - result = *inlen == 0 ? GCONV_EMPTY_INPUT : GCONV_FULL_OUTPUT; - break; - } - - /* Status so far. */ - result = GCONV_EMPTY_INPUT; - - if (data->outbufavail > 0) - { - /* Call the functions below in the chain. */ - size_t newavail = data->outbufavail; - - result = (*fct) (next_step, next_data, data->outbuf, &newavail, - written, 0); - - /* Correct the output buffer. */ - if (newavail != data->outbufavail && newavail > 0) - { - memmove (data->outbuf, - &data->outbuf[data->outbufavail - newavail], - newavail); - data->outbufavail = newavail; - } - } - } - while (*inlen > 0 && result == GCONV_EMPTY_INPUT); - - __set_errno (save_errno); - } - - if (written != NULL && data->is_last) - *written = do_write; - - return result; -} - - -int -__gconv_transform_utf8_internal (struct gconv_step *step, - struct gconv_step_data *data, - const char *inbuf, size_t *inlen, - size_t *written, int do_flush) -{ - struct gconv_step *next_step = step + 1; - struct gconv_step_data *next_data = data + 1; - gconv_fct fct = next_step->fct; - size_t do_write; - int result; - - /* If the function is called with no input this means we have to reset - to the initial state. The possibly partly converted input is - dropped. */ - if (do_flush) - { - /* Clear the state. */ - memset (data->statep, '\0', sizeof (mbstate_t)); - do_write = 0; - - /* Call the steps down the chain if there are any. */ - if (data->is_last) - result = GCONV_OK; - else - { - struct gconv_step *next_step = step + 1; - struct gconv_step_data *next_data = data + 1; - - result = (*fct) (next_step, next_data, NULL, 0, written, 1); - } - } + /* Determine the status. */ + if (*outptrp == outend) + result = GCONV_FULL_OUTPUT; + else if (*inptrp == inend) + result = GCONV_EMPTY_INPUT; else - { - int save_errno = errno; - int extra = 0; - do_write = 0; - - result = GCONV_OK; - do - { - wchar_t *outbuf = (wchar_t *) &data->outbuf[data->outbufavail]; - size_t cnt = 0; - size_t actually = 0; - - while (data->outbufavail + sizeof (wchar_t) <= data->outbufsize - && cnt < *inlen) - { - size_t start = cnt; - wchar_t value; - unsigned char byte; - int count; - - /* Next input byte. */ - byte = inbuf[cnt++]; - - if (byte < 0x80) - { - /* One byte sequence. */ - count = 0; - value = byte; - } - else if ((byte & 0xe0) == 0xc0) - { - count = 1; - value = byte & 0x1f; - } - else if ((byte & 0xf0) == 0xe0) - { - /* We expect three bytes. */ - count = 2; - value = byte & 0x0f; - } - else if ((byte & 0xf8) == 0xf0) - { - /* We expect four bytes. */ - count = 3; - value = byte & 0x07; - } - else if ((byte & 0xfc) == 0xf8) - { - /* We expect five bytes. */ - count = 4; - value = byte & 0x03; - } - else if ((byte & 0xfe) == 0xfc) - { - /* We expect six bytes. */ -