Commit Graph

10 Commits

Author SHA1 Message Date
Yaakov Selkowitz 9087163804 ansification: remove _DEFUN
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17 11:47:26 -06:00
Yaakov Selkowitz 6783860a2e ansification: remove _AND
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17 11:47:05 -06:00
Corinna Vinschen d16a56306d Consolidate wctomb/mbtowc calls for POSIX-1.2008
- Remove charset parameter from low level __foo_wctomb/__foo_mbtowc calls.
- Instead, create array of function for ISO and Windows codepages to point
  to function which does not require to evaluate the charset string on
  each call.  Create matching helper functions.  I.e., __iso_wctomb,
  __iso_mbtowc, __cp_wctomb and __cp_mbtowc are functions returning the
  right function pointer now.
- Create __WCTOMB/__MBTOWC macros utilizing per-reent locale and replace
  calls to __wctomb/__mbtowc with calls to __WCTOMB/__MBTOWC.
- Drop global __wctomb/__mbtowc vars.
- Utilize aforementioned changes in Cygwin to get rid of charset in other,
  calling functions and simplify the code.
- In Cygwin restrict global cygheap locale info to the job performed
  by internal_setlocale.  Use UTF-8 instead of ASCII on the fly in
  internal conversion functions.
- In Cygwin dll_entry, make sure to initialize a TLS area with a NULL
  _REENT->_locale pointer.  Add comment to explain why.

Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:57 +02:00
Joel Sherrill 380c9f6165 2013-11-26 Julio Gutierrez <jgutleyva@gmail.com>
*libc/include/wchar.h: Add restrict keyword.
	*libc/stdio/fgetws.c (fgetws): ditto.
	*libc/stdio/fputws.c (fputws): ditto.
	*libc/stdio/fwprintf.c (fwprintf): ditto.
	*libc/stdio/fwscanf.c (fwscanf): ditto.
	*libc/stdio/swprintf.c (swprintf): ditto.
	*libc/stdio/swscanf.c (swscanf): ditto.
	*libc/stdio/vfwprintf.c (vfwprintf): ditto.
	*libc/stdio/vfwscanf.c (vfwscanf): ditto.
	*libc/stdio/vswprintf.c (vswprintf): ditto.
	*libc/stdio/vswscanf.c (vswscanf): ditto.
	*libc/stdio/vwprintf.c (vwprintf): ditto.
	*libc/stdio/vwscanf.c (vwscanf): ditto.
	*libc/stdio/wprintf.c (wprintf): ditto.
	*libc/stdio/wscanf.c (wscanf): ditto.
	*libc/stdlib/mbrlen.c (mbrlen): ditto.
	*libc/stdlib/mbrtowc.c (mbrtowc): ditto.
	*libc/stdlib/mbsnrtowcs.c (mbsnrtowcs): ditto.
	*libc/stdlib/mbsrtowcs.c (mbsrtowcs): ditto.
	*libc/stdlib/wcrtomb.c (wcrtomb): ditto.
	*libc/stdlib/wcsnrtombs.c (wcsnrtombs): ditto.
	*libc/stdlib/wcsrtombs.c (wcsrtombs): ditto.
	*libc/stdlib/wcstod.c (wcstod): ditto.
	*libc/stdlib/wcstol.c (wcstol): ditto.
	*libc/stdlib/wcstold.c (wcstold): ditto.
	*libc/stdlib/wcstoll.c (wcstoll): ditto.
	*libc/stdlib/wcstoul.c (wcstoul): ditto.
	*libc/stdlib/wcstoull.c (cstoull): ditto.
	*libc/string/wcpcpy.c (wcpcpy): ditto.
	*libc/string/wcpncpy.c (wcpncpy): ditto.
	*libc/string/wcscat.c (wcscat): ditto.
	*libc/string/wcscpy.c (wcscpy): ditto.
	*libc/string/wcsncat.c (wcsncat): ditto.
	*libc/string/wcsncpy.c (wcsncpy): ditto.
	*libc/string/wcsstr.c (wcsstr): ditto.
	*libc/string/wcstok.c (wcstok): ditto.
	*libc/string/wcsxfrm.c (wcsxfrm): ditto.
	*libc/string/wmemcpy.c (wmemcpy): ditto.
2013-11-26 17:21:01 +00:00
Jeff Johnston b334e6660a 2013-04-29 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libc/stdio/local.h (CHECK_INIT): Evaluate argument only once.
	(CHECK_STD_INIT): Likewise.
	* libc/stdio/fgetc.c (fgetc): Use local variable for _REENT.
	* libc/stdio/fgetwc.c (fwgetc): Likewise.
	* libc/stdio/fgetws.c (fgetws): Likewise.
	* libc/stdio/fputc.c (fputc): Likewise.
	* libc/stdio/fputwc.c (fputwc): Likewise.
	* libc/stdio/fputws.c (fputws): Likewise.
	* libc/stdio/getc.c (getc): Likewise.
	* libc/stdio/getchar.c (_getchar_r): Likewise.
	* libc/stdio/putc.c (putc): Likewise.
	* libc/stdio/putchar.c (putchar): Likewise.
	* libc/stdio/scanf.c (scanf): Likewise.
	* libc/stdio/setvbuf.c (setvbuf): Likewise.
	* libc/stdio/ungetwc.c (ungetwc): Likewise.
	* libc/stdio/vfscanf.c (VFSCANF): Likewise.
	* libc/stdio/vfwscanf.c (VFWSCANF): Likewise.
	* libc/stdio/viprintf.c (viprintf): Likewise.
	* libc/stdio/viscanf.c (viscanf): Likewise.
	* libc/stdio/vprintf.c (vprintf): Likewise.
	* libc/stdio/vscanf.c (vscanf): Likewise.
	* libc/stdio/vwprintf.c (vwprintf): Likewise.
	* libc/stdio/vwscanf.c (vwscanf): Likewise.
	* libc/stdio/wscanf.c (wscanf): Likewise.
	* libc/stdlib/ecvtbuf.c (fcvtbuf): Likewise.
	(fcvtbuf): Likewise.
	(ecvtbuf): Likewise.
	(ecvtbuf): Likewise.
	* libc/stdlib/mblen.c (mblen): Likewise.
	* libc/stdlib/mbrlen.c (mbrlen): Likewise.
	* libc/stdlib/mbrtowc.c (mbrtowc): Likewise.
	* libc/stdlib/mbtowc.c (mbtowc): Likewise.
	* libc/stdlib/rand.c (srand): Likewise.
	(rand): Likewise.
	* libc/stdlib/wcrtomb.c (wcrtomb): Likewise.
	* libc/stdlib/wctob.c (wctob): Likewise.
	* libc/stdlib/wctomb.c (wctomb): Likewise.
	* libc/string/strtok.c (strtok): Likewise.
	* libc/time/asctime.c (asctime): Likewise.
	* libc/time/gmtime.c (gmtime): Likewise.
	* libc/time/lcltime.c (lcltime): Likewise.
2013-04-29 21:06:23 +00:00
Corinna Vinschen b4fee5273e * libc/stdio/vfprintf.c: Include ../stdlib/local.h. Replace call to
_mbtowc_r with direct call to __mbtowc.
	* libc/stdio/vfscanf.c: Ditto.
	* libc/stdlib/btowc.c: Include local.h.  Replace call to _mbtowc_r
	with direct call to __mbtowc.
	* libc/stdlib/mblen.c: Ditto.
	* libc/stdlib/mblen_r.c: Ditto.
	* libc/stdlib/mbrtowc.c: Ditto.
	* libc/stdlib/mbstowcs_r.c: Ditto.
	* libc/stdlib/mbtowc.c: Ditto.
	* libc/stdlib/wcrtomb.c: Include local.h.  Replace call to _wctomb_r
	with direct call to __wctomb.
	* libc/stdlib/wcsnrtombs.c: Ditto.
	(_wcsnrtombs_r): Ditto.
	* libc/stdlib/wcstombs_r.c: Ditto.
	* libc/stdlib/wctob.c: Ditto.
	* libc/stdlib/wctomb.c: Ditto.

	* libc/stdlib/mbrtowc.c (mbrtowc): Implement independently from
	_mbrtowc_r, unless PREFER_SIZE_OVER_SPEED or __OPTIMIZE_SIZE__ are
	defined.
	* libc/stdlib/wcrtomb.c (wcrtomb): Implement independently from
	_wcrtomb_r, unless PREFER_SIZE_OVER_SPEED or __OPTIMIZE_SIZE__ are
	defined.

	* libc/stdlib/mbtowc_r.c (__utf8_mbtowc): Drop unnecessary test for
	ch >= 0.
2009-11-18 09:49:57 +00:00
Jeff Johnston f777e3a5ac 2004-04-23 Artem B. Bityuckiy <abitytsky@softminecorp.com>
* configure.in: Define _MB_CAPABLE if mb supported.
        * configure: Regenerated.
        * configure.host: Remove manual setting of MB_CAPABLE compiler
        flag.
        * newlib.hin: Add _MB_CAPABLE flag.
        * libc/ctype/iswalpha.c, libc/ctype/iswblank.c: Include <newlib.h>
        and check for _MB_CAPABLE flag instead of MB_CAPABLE.
        * libc/ctype/iswcntrl.c, libc/ctype/iswprint.c: Ditto.
        * libc/ctype/iswpunct.c, libc/ctype/iswspace.c: Ditto.
        * libc/ctype/jp2uc.c: Ditto.
        * libc/ctype/towlower.c, libc/ctype/towupper.c: Ditto.
        * libc/locale/locale.c: Ditto
        * libc/machine/powerpc/vfscanf.c: Ditto
        * libc/stdio/vfprintf.c, libc/stdio/vfscanf.c: Ditto
        * libc/stdlib/mblen.c: Ditto
        * libc/stdlib/mblen_r.c, libc/stdlib/mbrlen.c: Ditto
        * libc/stdlib/mbrtowc.c, libc/stdlib/mbsrtowcs.c: Ditto
        * libc/stdlib/mbstowcs.c, libc/stdlib/mbtowc.c: Ditto
        * libc/stdlib/mbtowc_r.c, libc/stdlib/wcrtomb.c: Ditto
        * libc/stdlib/wcsrtombs.c, libc/stdlib/wcstombs.c: Ditto
        * libc/stdlib/wctomb.c, libc/sys/linux/intl/dcigettext.c: Ditto
        * libc/sys/linux/intl/explodename.c: Ditto
        * libc/sys/linux/intl/finddomain.c: Ditto
        * libc/sys/linux/intl/l10nflist.c: Ditto
        * libc/sys/linux/intl/loadmsgcat.c: Ditto
        * libc/sys/linux/intl/localealias.c: Ditto
2004-04-23 21:44:22 +00:00
Christopher Faylor 576593dd72 * libc/stdlib/mbrlen.c: Change include order to prevent compiler errors when
defining _mbrtowc.
* libc/stdlib/mbsinit.c: Ditto.
* libc/stdlib/mbsrtowcs.c: Ditto.
* libc/stdlib/wcrtomb.c: Ditto.
* libc/stdlib/wcsrtombs.c: Ditto.
* libc/stdlib/wctob.c: Ditto.
* libc/stdlib/mbrlen.c: Change include order to prevent compiler errors when
defining _mbrtowc.
* libc/stdlib/mbsinit.c: Ditto.
* libc/stdlib/mbsrtowcs.c: Ditto.
2003-12-05 06:13:44 +00:00
Jeff Johnston 9c64d2a7ba 2002-09-09 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/sys/_types.h (_mbstate_t): Changed to use
        unsigned char internally.
        * libc/sys/linux/sys/_types.h: Ditto.
        * libc/include/sys/reent.h
        * libc/stdlib/mblen.c (mblen): Use function-specific state
        value from default reentrancy structure.
        * libc/stdlib/mblen_r.c (_mblen_r):  If return code from
        _mbtowc_r is less than 0, reset state __count value and
        return -1.
        * libc/stdlib/mbrlen.c (mbrlen): If the input state pointer
        is NULL, use the function-specific pointer provided in the
        default reentrancy structure.
        * libc/stdlib/mbrtowc.c: Add reentrant form of function.
        If input state pointer is NULL, use function-specific area
        provided in reentrancy structure.
        * libc/stdlib/mbsrtowcs.c: Ditto.
        * libc/stdlib/wcrtomb.c: Ditto.
        * libc/stdlib/wcsrtombs.c: Ditto.
        * libc/stdlib/mbstowcs.c: Reformat.
        * libc/stdlib/wcstombs.c: Ditto.
        * libc/stdlib/mbstowcs_r.c (_mbstowcs_r): If an error occurs,
        reset the state's __count value and return -1.
        * libc/stdlib/mbtowc.c: Ditto.
        * libc/stdlib/mbtowc_r.c (_mbtowc_r): Add restartable functionality.
        If number of bytes is used up before completing a valid multibyte
        character, return -2 and save the state.
        * libc/stdlib/wctomb_r.c (_wctomb_r): Define __state as __count
        and change some __count references to __state for clarity.
2002-09-09 21:42:14 +00:00
Thomas Fitzsimmons 8d9112f2f3 * libc/include/langinfo.h: New file.
* libc/include/wchar.h: Likewise.
	* libc/include/sys/syslimits.h: Likewise.
	* libc/locale/fix_grouping.c: Likewise.
	* libc/locale/ldpart.c: Likewise.
	* libc/locale/ldpart.h: Likewise.
	* libc/locale/lmessages.c: Likewise.
	* libc/locale/lmessages.h: Likewise.
	* libc/locale/lmonetary.c: Likewise.
	* libc/locale/lmonetary.h: Likewise.
	* libc/locale/lnumeric.c: Likewise.
	* libc/locale/lnumeric.h: Likewise.
	* libc/locale/nl_langinfo.3: Likewise.
	* libc/locale/nl_langinfo.c: Likewise.
	* libc/locale/timelocal.c: Likewise.
	* libc/locale/timelocal.h: Likewise.
	* libc/stdlib/btowc.c: Likewise.
	* libc/stdlib/mbrlen.c: Likewise.
	* libc/stdlib/mbrtowc.c: Likewise.
	* libc/stdlib/mbsinit.c: Likewise.
	* libc/stdlib/mbsrtowcs.c: Likewise.
	* libc/stdlib/wcrtomb.c: Likewise.
	* libc/stdlib/wcsrtombs.c: Likewise.
	* libc/stdlib/wctob.c: Likewise.
	* libc/sys/linux/prof-freq.c: Likewise.
	* libc/sys/linux/profile.c: Likewise.
	* libc/sys/linux/machine/i386/dl-procinfo.c: Likewise.
	* libc/sys/linux/machine/i386/dl-procinfo.h: Likewise.
	* libc/include/stdlib.h: Change re-entrant functions to take
	mbstate_t pointers.
	* libc/include/sys/_types.h: Define _mbstate_t.
	* libc/include/sys/config.h (MB_LEN_MAX): New macro.
	* libc/include/sys/errno.h (EILSEQ): New error code.
	* libc/include/sys/reent.h: Include wchar.h.  Change reentrant
	structure to use mbstate_t.
	* libc/locale/Makefile.am (LIB_SOURCES): Add new files.
	* libc/machine/powerpc/vfprintf.c: Use mbstate_t.
	* libc/machine/powerpc/vfscanf.c: Likewise.
	* libc/stdio/getdelim.c: Reallocate buffer only when necessary.
	* libc/stdio/vfprintf.c: Likewise.
	* libc/stdio/vfscanf.c: Likewise.
	* libc/stdlib/Makefile.am (LIB_SOURCES): Add new files.
	* libc/stdlib/mblen.c: Use mbstate_t.
	* libc/stdlib/mblen_r.c: Likewise.
	* libc/stdlib/mbstowcs.c: Likewise.
	* libc/stdlib/mbstowcs_r.c: Likewise.
	* libc/stdlib/mbtowc.c: Likewise.
	* libc/stdlib/mbtowc_r.c: Likewise.
	* libc/stdlib/wcstombs.c: Likewise.
	* libc/stdlib/wcstombs_r.c: Likewise.
	* libc/stdlib/wctomb_r.c: Likewise.
	* libc/sys/linux/Makefile.am (LIB_SOURCES): Add prof-freq.c and
	profile.c.
	* libc/sys/linux/machine/i386/Makefile.am (LIB_SOURCES): Add
	dl-procinfo.c.
	* libc/sys/linux/sys/errno.h (EILSEQ): New error code.
	* libc/sys/linux/sys/types.h (off_t): Define type.
	* testsuite/newlib.locale/UTF-8.c: Change locale name from UTF-8
	to C-UTF-8.
	* testsuite/newlib.locale/UTF-8.exp: Likewise.
2002-08-23 01:56:05 +00:00