Commit Graph

358 Commits

Author SHA1 Message Date
Jeff Johnston c2bbc54a62 Fix atexit logic to honor _ATEXIT_DYNAMIC_ALLOC setting.
If small reent is enabled (_REENT_SMALL is defined) then malloc() was
used in __register_exitproc() even if user requested it to be disabled
(_ATEXIT_DYNAMIC_ALLOC is defined). With this fix, function fails when
_ATEXIT_DYNAMIC_ALLOC is defined and whole static storage is already
used.

2015-12-21  Freddie Chopin  <freddie.chopin@gmail.com>

        * libc/stdlib/__atexit.c (__register_exitproc): Fix for
        _ATEXIT_DYNAMIC_ALLOC.
2015-12-21 11:53:14 -05:00
Jeff Johnston d2bb300b9b Add static instance of _on_exit_args for _REENT_SMALL platforms.
2015-12-21  Freddie Chopin  <freddie.chopin@gmail.com>

        * libc/stdlib/on_exit_args.{c,h}: New files.
        * libc/stdlib/Makefile.am: Add new source file.
        * libc/stdlib/Makefile.in: Regenerate.
        * libc/stdlib/__atexit.c (__register_exitproc): Initialize
        _on_exit_args_ptr field of _GLOBAL_ATEXIT on first run.
        * libc/stdlib/on_exit.c: Force linking of static instance of
        _on_exit_args.
        * libc/stdlib/cxa_atexit.c: Likewise.
2015-12-21 11:49:28 -05:00
Freddie Chopin c39ad27d9e Add missing lock releases in __register_exitproc().
In some code paths the __atexit_lock held by this function was not
released when returning with an error.

        * libc/stdlib/__atexit.c (__register_exitproc): Always release
        lock before return.
2015-12-14 14:31:36 +01:00
Corinna Vinschen 1628bb8995 Only build _strtodg_r on targets supporting a distinct long double type
* libc/stdlib/strtodg.c: Add ifdef to check _HAVE_LONG_DOUBLE and
	_LDBL_EQ_DBL.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-11-26 10:13:53 +01:00
Steve Ellcey 10677229b9 libc/stdlib/strtorx.c: Fix ifdef to check _LDBL_EQ_DBL. 2015-11-24 13:59:31 -08:00
Corinna Vinschen 666a3482a5 Handle multibyte decimapl point in strtold.
* libc/stdlib/strtodg.c: Define USE_LOCALE.
	(_strtodg_r): Handle multibyte decimal point.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-11-21 16:40:21 +01:00
Corinna Vinschen fbace81684 Import correctly working strtold from David M. Gay.
* libc/stdlib/Makefile.am (GENERAL_SOURCES): Add strtodg.c and
	strtorx.c.
	* libc/stdlib/Makefile.in: Regenerate.
	* libc/stdlib/strtodg.c: New file implementing generic string to long
	double conversion.
	* libc/stdlib/strtorx.c: New file, implementing IEEE format string to
	long double conversion.
	* libc/stdlib/mprec.h (_strtodg_r): Declare.
	(_strtorx_r): Declare.
	* libc/stdlib/gdtoa.h (__UShort): Define.
	* libc/stdlib/strtold.c (__flt_rounds): Define for i386 and x86_64
	target.
	(FLT_ROUNDS): Define, as 0 on platforms missing a __flt_rounds
	function.
	(_strtold_r): Converted from strtold.  Call _strtorx_r on targets
	supporting distinct long doubles.
	(strtold): Just call _strtold_r.
	* libc/include/stdlib.h (_strtold_r): Declare.
	* libc/stdlib/ldtoa.c (_strtold): Comment out.  Explain why.
	* libc/stdio/vfscanf.c (__SVFSCANF_R): Call _strtold_r instead of
	_strtold.
	* libc/machine/powerpc/vfscanf.c (__svfscanf_r): Ditto.

	* common.din (strtold): Drop redirection to _strtold.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-11-20 18:14:58 +01:00
Corinna Vinschen 51bf1b81f3 Make match function globally available to stdlib functions.
* libc/stdlib/strtod.c (match): Move from here...
	* libc/stdlib/gdtoa-hexnan.c (match): ...to here.
	* libc/stdlib/mprec.h (match): Declare and add __match define.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-11-20 18:03:05 +01:00
Corinna Vinschen b5d8a403ec Drop unused declaration from wcstold.c
* libc/stdlib/wcstold.c (_strtold): Drop unused declaration.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-11-20 17:57:20 +01:00
Yaakov Selkowitz 1c1a925fc4 Fix typo in rpmatch doc reference
* libc/stdlib/stdlib.tex: Fix typo in rpmatch reference.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2015-11-19 15:28:06 -06:00
Corinna Vinschen fcc2dcbb21 ldtoa.c: Reindent to GNU style
* libc/stdlib/ldtoa.c: Convert to GNU style so as not to get crazy
	reading the code.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-11-19 17:09:58 +01:00
Corinna Vinschen e2802064b2 Fix rpmatch build problem
* libc/stdlib/rpmatch.c: Include sys/types.h to make GCC happy.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-11-19 16:31:08 +01:00
Yaakov Selkowitz 9a6acafd04 Add rpmatch(3)
2015-11-17  Yaakov Selkowitz  <yselkowi@redhat.com>

* libc/include/stdlib.h (rpmatch): Declare.
* libc/stdlib/Makefile.am (ELIX_4_SOURCES): Add rpmatch.c.
(CHEWOUT_FILES): Add rpmatch.def.
* libc/stdlib/Makefile.in: Regenerate.
* libc/stdlib/rpmatch.c: New file.
* libc/stdlib/stdlib.tex: Add references to rpmatch.
2015-11-17 12:00:20 -06:00
Jeff Johnston 0631279394 Move duplicated documentation rules to Makefile.shared
- Also, harmonize libm to use CHEWOUT_FILES like libc, rather than chobj.
  Update documentation appropriately.

        * HOWTO: Update.
        * Makefile.shared: Move documentation rules to here...
        * libc/argz/Makefile.am: ... from here ...
        * libc/ctype/Makefile.am: ... and here.
        * libc/errno/Makefile.am: Ditto.
        * libc/iconv/Makefile.am: Ditto.
        * libc/iconv/ccs/Makefile.am : Ditto.
        * libc/iconv/ces/Makefile.am: Ditto.
        * libc/iconv/lib/Makefile.am: Ditto.
        * libc/locale/Makefile.am: Ditto.
        * libc/misc/Makefile.am: Ditto.
        * libc/posix/Makefile.am: Ditto.
        * libc/reent/Makefile.am: Ditto.
        * libc/search/Makefile.am: Ditto.
        * libc/stdio/Makefile.am: Ditto.
        * libc/stdio64/Makefile.am: Ditto.
        * libc/stdlib/Makefile.am : Ditto.
        * libc/string/Makefile.am: Ditto.
        * libc/syscalls/Makefile.am: Ditto.
        * libc/time/Makefile.am : Ditto.
        * libc/unix/Makefile.am: Ditto.
        * libc/xdr/Makefile.am: Ditto.
        * libm/common/Makefile.am: Ditto.
        * libm/complex/Makefile.am: Ditto.
        * libm/math/Makefile.am: Ditto.
        * libm/mathfp/Makefile.am: Ditto.
2015-11-02 18:02:39 -05:00
Sebastian Huber f86afe5a3a C11 aligned_alloc() implementation
aligned_alloc() is implemented in terms of posix_memalign() which is
only declared in <stdlib.h> but not defined in Newlib in general.  At
least Linux and RTEMS implement this function.

newlib/ChangeLog
2015-10-14  Sebastian Huber  <sebastian.huber@embedded-brains.de>

	* libc/stdlib/Makefile.am (GENERAL_SOURCES): Add
	alloc_aligned.c.c.
	* libc/stdlib/Makefile.in: Regenerate.
	* libc/stdlib/aligned_alloc.c: New.
2015-10-19 14:10:33 +02:00
Sebastian Huber d67f71ab85 C11 quick_exit() support for <stdlib.h>
Import some <stdlib.h> function declarations from latest FreeBSD and
implement them.  I am not sure if we should call the global reent
cleanup in quick_exit() similar to exit().

newlib/ChangeLog
2015-10-14  Sebastian Huber  <sebastian.huber@embedded-brains.de>

	* libc/include/stdlib.h (at_quick_exit): Declare.
	(quick_exit): Likewise.
	* libc/stdlib/Makefile.am (GENERAL_SOURCES): Add
	quick_exit.c.
	* libc/stdlib/Makefile.in: Regenerate.
	* libc/stdlib/quick_exit.c: New.
2015-10-19 14:09:17 +02:00
Jon TURNEY 166d86c9d4 Regenerate Makefile.in
Regenerate Makefile.in with changes in commits 153385d8 and 433aad91

2015-06-29  Jon Turney  <jon.turney@dronecode.org.uk>

	* libc/ctype/Makefile.in: Regenerate.
	* libc/posix/Makefile.in: Ditto.
	* libc/stdio/Makefile.in: Ditto.
	* libc/stdio64/Makefile.in: Ditto.
	* libc/stdlib/Makefile.in: Ditto.
	* libc/string/Makefile.in: Ditto.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-29 12:29:50 +01:00
Jon TURNEY a4dd7dd87c Use makedoc output files which are generated but aren't included
I think these are accidental omissions, as these source files are listed to be
chewed by makedoc, but the result is not included by any texinfo source file.

Future work: Nothing in libc/reent/ which is processed by makedoc is included by
reent.tex

2015-06-23  Jon Turney  <jon.turney@dronecode.org.uk>

	* libc/stdlib/stdlib.tex: Include itoa and utoa, and add to menu.
	* libc/string/strings.tex: Include memrchr and rawmemchr, and add
	to menu.
	* libm/math/math.tex: Include exp10 and pow10, and add to menu.
	* libm/common/s_exp10.c: Improve one-line description.
	* libm/common/s_exp10.c: Ditto.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-24 12:23:55 +01:00
Jon TURNEY 433aad912d Don't chew files which contain no documentation markup
Don't chew files which contain no documentation markup.

Neither of the alternatives for MALLOCR (mallocr.c or nano-mallocr.c) contain
any documentation markup.

2015-06-23  Jon Turney  <jon.turney@dronecode.org.uk>

	* libc/stdlib/Makefile.am (CHEWOUT_FILES): Remove $(MALLOCR).def.
	* libc/stdio/Makefile.am (CHEWOUT_FILES): Remove getwc.def and
	putwc.def.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-24 12:23:49 +01:00
Jon TURNEY de5e58a640 Fix typo-ed function names in efgcvt.c documentation
Fix typo-ed function names in efgcvt.c documentation, neither gvcvt nor gdvtf
exists.

2015-06-23  Jon Turney  <jon.turney@dronecode.org.uk>

	* libc/stdlib/efgcvt.c: Fix typo-ed function names in
	documentation.
	* libc/stdlib/stdlib.tex: Fix function name in menu to match.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-23 20:56:30 +01:00
Jon TURNEY ff4a4f2655 Fix SYNOPSIS prototypes without marked up parameter names
2015-06-23  Jon Turney  <jon.turney@dronecode.org.uk>

	* libc/stdlib/llabs.c: Mark up parameter name in ANSI_SYNOPSIS.
	* libc/time/tzset.c: Add and mark up parameter in SYNOPSIS.
	* libm/common/s_nan.c: Ditto.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-23 17:30:22 +01:00
Jon TURNEY c7b1e4cbf2 Fix some mangled makedoc markup
2015-06-23  Jon Turney  <jon.turney@dronecode.org.uk>

	* libc/stdlib/itoa.c: Fix makedoc markup.
	* libc/stdlib/wcsnrtombs.c: Ditto.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-23 16:14:53 +01:00
Corinna Vinschen 9b42474f29 Fix UTF-16 surrogate handling in wctomb and friends.
* libc/stdlib/wctomb_r.c (__utf8_wctomb): Fix check for handling a
	lone high surrogate.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 21:57:09 +02:00
Craig Howland 382fa90fe1 Move tzset calls to time functions.
* libc/stdlib/setenv_r.c (_setenv_r): Remove tzset() call for TZ
	definition.
	* libc/time/lcltime_r.c (localtime_r): Add tzset() call
	* libc/time/mktime.c (mktime):  Ditto.
	* libc/time/strftime.c (strftime, wcsftime): Ditto.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 21:57:08 +02:00
Nick Clifton 1f3dd90552 * libc/stdlib/wcstold.c (wcstold): Add implementation for when
long double is not the same as double.
2015-01-29 08:37:26 +00:00
Jeff Johnston 0615b4bb5f 2014-12-18 Jeff Johnston <jjohnstn@redhat.com>
* NEWS: Update with 2.2.0 info.
        * README: Ditto.
        * acinclude.m4: Change version number to 2.2.0.
        * libc/libc.texinfo: Ditto.
        * libm/libm.texinfo: Ditto.
        * configure: Regenerated.
        * Makefile.in: Regenerated.
        * doc/configure: Ditto.
        * libc/*/configure: Ditto.
        * libm/*/configure: Ditto.
        * libc/sys/linux/shared.ld: Add VERS_2.2
2014-12-18 20:30:11 +00:00
DJ Delorie ae4a2bd820 * libc/stdlib/nano-mallocr.c (ALIGN_TO): Do not assume that
integers are as big as pointers.
2014-12-16 20:46:25 +00:00
Corinna Vinschen 32c96ddd14 * libc/include/stdlib.h (__itoa): Declare prototype.
(__utoa): Ditto.
	(itoa): Ditto, non-strict-ANSI only.
	(utoa): Ditto.
	* libc/stdlib/Makefile.am: Add itoa.c and utoa.c.
	* libc/stdlib/Makefile.in: Regenerate.
	* libc/stdlib/itoa.c: New file.
	* libc/stdlib/utoa.c: New file.
2014-12-16 10:55:17 +00:00
Corinna Vinschen 3dce84ad07 * libc/stdlib/strtod.c (sulp): Cast to int32_t to avoid overflow.
* libc/time/gmtime_r.c (DAYS_PER_*_YEARS): Convert to long constants
	to avoid overflow.
2014-11-12 09:10:22 +00:00
Jeff Johnston b7f5fb36f1 2014-03-21 Maciej W. Rozycki <macro@codesourcery.com>
* libc/stdlib/gd_qnan.h (f_QNAN, d_QNAN0, d_QNAN1): Add MIPS
        versions.
        (ld_QNAN0, ld_QNAN1, ld_QNAN2, ld_QNAN3): Don't define for MIPS.
        (ldus_QNAN0, ldus_QNAN1, ldus_QNAN2, ldus_QNAN3, ldus_QNAN4):
        Likewise.
        * libc/stdlib/ldtoa.c (nan113, nan64, nan53, nan24): Add MIPS
        versions.
        (enan): Handle legacy MIPS payloads.
        * libm/common/s_nan.c (nan): Use __builtin_nan if supported by
        the compiler.
        * libm/common/sf_nan.c (nanf): Likewise.
2014-03-21 21:27:29 +00:00
Corinna Vinschen 0b3ad39364 * libc/include/stdlib.h (strtold): Define if _HAVE_LONG_DOUBLE is
defined.
	* libc/stdlib/strtold.c (strtold): Ditto.  Call strtod on systems
	with long double == double, _strtold otherwise.
2014-03-07 20:06:54 +00: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
Joel Sherrill 8ab08406da 2013-11-18 Sahil Patnayakuni <sahilp@oarcorp.com>
* libc/include/stdlib.h, libc/stdlib/mbstowcs.c,
	libc/stdlib/mbstowcs_r.c, libc/stdlib/mbtowc.c,
	libc/stdlib/mbtowc_r.c, libc/stdlib/strtod.c,
	libc/stdlib/strtol.c, libc/stdlib/strtold.c,
	libc/stdlib/strtoll.c, libc/stdlib/strtoll_r.c,
	libc/stdlib/strtoul.c, libc/stdlib/strtoull.c,
	libc/stdlib/strtoull_r.c, libc/stdlib/wcstombs.c,
	libc/stdlib/wcstombs_r.c: Add restrict keyword.
2013-11-18 17:26:52 +00:00
Corinna Vinschen 2b2290caba * newlib/libc/stdlib/getopt.c (getopt_internal): Add missing braces. 2013-11-13 20:04:18 +00:00
Corinna Vinschen 02365c2064 * newlib/libc/include/getopt.h (struct option): name field should be
"const char *".
	* newlib/libc/stdlib/getopt.c (getopt_internal): Use fputs()/fputc()
	instead of fprintf() to save code space.  Fix signed/unsigned
	comparison.
2013-11-13 09:09:45 +00:00
Corinna Vinschen f1359420da * libc/libc/stdlib/getopt.c (getopt_internal): Fix NULL pointer access. 2013-11-12 11:30:32 +00:00
Corinna Vinschen 566fd12b68 Implement malloc_stats for nano.
* libc/stdlib/nano-mallocr.c (RONECALL): New parameter macro.
	(sbrk_start): New variable.
	(current_mallinfo, free_list): Forward declaration of data.
	(chunk): Define size as long type.
	(mallinfo): Synchronize with latest malloc.h.
	(nano_*): Forward declaration of functions.
	(get_chunk_from_ptr): Defined to static inline.
	(nano_mallinfo): Implement this function.
	(nano_malloc_stats): Implement this function.
2013-10-30 15:53:05 +00:00
Jeff Johnston 00fd23d50f 2013-09-13 Joey Ye <joey.ye@arm.com>
* libc/stdlib/nano-mallocr.c (nano_allopt): Typo fixed to ...
	(nano_mallopt): ... this.
2013-09-13 16:51:48 +00:00
Corinna Vinschen cbd871ad41 * libc/stdlib/__atexit.c (__register_exitproc): NULL-ify
_on_exit_args_ptr when creating a new _atexit structure while
	_REENT_SMALL is defined.
2013-08-19 09:03:42 +00:00
Jeff Johnston e2ac49d3d7 2013-07-02 Joey Ye <joey.ye@arm.com>
Lite exit support.
        * README: Add information about lite-exit.
        * acconfig.h (_LITE_EXIT): New macro.
        * configure.in (enable-lite-exit): New option.
        (_LITE_EXIT): Define new macro.
        * configure: Regenerated.
        * newlib.hin (_LITE_EXIT): New macro.
        * libc/stdlib/__atexit.c [_LITE_EXIT]: Add dummy explicit
        reference to __call_exitprocs.
        * libc/stdlib/cxa_atexit.c [_LITE_EXIT]: Make __register_exitproc a
        weak reference.
        * libc/stdlib/exit.c (exit)[_LITE_EXIT]: Remove TWS and weakly reference
        __call_exitprocs.
2013-07-02 21:30:57 +00:00
Corinna Vinschen e9c0122ec0 * libc/stdlib/gdtoa-gethex.c (__hexdig): Constify.
(hexdig_init): Remove.
	(__hexdig_fun): New function.
	hexdig_init, added __hexdig_fun
	(gethex): Call __get_hexdig macro rather than hexdig.
	* libc/stdlib/gdtoa-hexnan.c (hexnan): Constify fpi argument.
	Call __get_hexdig macro rather than hexdig.
	* libc/stdlib/ldtoa.c: Throughout constify functions arguments where
	required by constifying the following arrays.
	(ezero): Constify.
	(eone): Constify.
	(ermsg): Constify.
	(etens): Constify.
	(emtens): Constify.
	(nan113): Constify.
	(nan64): Constify.
	(nan53): Constify.
	(nan24): Constify.
	* libc/stdlib/mprec.h (__get_hexdig): Define.
	(gethex): Constify args in declaration where appropriate.
	(hexnan): Ditto.
	(hexdig_init): Remove declaration.
	(__hexdig_fun): Declare.
	* libc/stdlib/strtod.c (fpi): Constify.
	(fpinan): Constify.
2013-06-10 15:27:43 +00:00
Corinna Vinschen a83263b981 * configure.in (--enable-newlib-nano-malloc): New option.
* configure: Regenerated.
	* libc/configure.in (--enable-newlib-nano-malloc): New option.
	* libc/configure: Regenerated.
	* libc/stdlib/Makefile.am (NEWLIB_NANO_MALLOC): Use.
	* libc/stdlib/Makefile.in: Regenerated.
	* libc/stdlib/nano-mallocr.c: New file, implementing nano
	version malloc family functions.
2013-05-29 12:37:59 +00:00
Jeff Johnston 1b7ad41e50 2013-05-07 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libc/include/sys/config.h (_REENT_GLOBAL_ATEXIT): Define for
        RTEMS.
        * libc/include/sys/reent.h (_reent): Use _REENT_GLOBAL_ATEXIT.
        (_global_atexit): Declare if _REENT_GLOBAL_ATEXIT is defined.
        * libc/reent/reent.c (_reclaim_reent): Remove atexit cleanup if
        _REENT_GLOBAL_ATEXIT is defined.
        (_wrapup_reent): Remove atexit handling if _REENT_GLOBAL_ATEXIT
        is defined.
        * libc/stdlib/__atexit.c (_global_atexit0): Define if
        _REENT_GLOBAL_ATEXIT is defined.
        * libc/stdlib/__call_atexit.c (_global_atexit): Define if
        _REENT_GLOBAL_ATEXIT is defined.
2013-05-08 23:13:51 +00:00
Jeff Johnston 6bd6954bdc 2013-05-07 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libc/include/sys/reent.h (_ATEXIT_INIT): Define.
	(_ATEXIT_INIT_PTR): Likewise.
	(_REENT_INIT_ATEXIT): Likewise.
	(_REENT_INIT_ATEXIT_PTR): Likewise.
	(_GLOBAL_ATEXIT): Likewise.
	* libc/stdlib/__atexit.c (_GLOBAL_ATEXIT0): Define.
	(__register_exitproc): Use _GLOBAL_ATEXIT and _GLOBAL_ATEXIT0.
	* libc/stdlib/__call_atexit.c (__call_exitprocs): Likewise.
-
2013-05-07 21:40:10 +00:00
Jeff Johnston c0e447afd0 2013-05-07 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libc/stdlib/__atexit.c (__atexit_lock): Declare.
        * libc/stdlib/__call_atexit.c (__atexit_lock): Define.
2013-05-07 18:24:14 +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 6fb85adeac * libc/stdlib/strtod.c: Manual update to latest algorithm from NetBSD. 2013-04-24 10:21:16 +00:00
Jeff Johnston f2d223bd0f 2012-12-20 Jeff Johnston <jjohnstn@redhat.com>
* NEWS: Update with 2.0.0 info.
        * README: Ditto.
        * acinclude.m4: Change version number to 2.0.0.
        * aclocal.m4: Regenerated.
        * configure: Ditto.
        * Makefile.in: Regenerated.
        * doc/aclocal.m4: Ditto.
        * doc/configure: Ditto.
        * libc/*/aclocal.m4: Ditto.
        * libc/*/configure: Ditto.
        * libc/libc.texinfo: Ditto.
        * libm/*/aclocal.m4: Ditto.
        * libm/*/configure: Ditto.
        * libm/libm.texinfo: Ditto.
        * libc/sys/linux/shared.ld: Add VERS_2.0
2012-12-20 21:10:27 +00:00
Corinna Vinschen fb2b6cb868 * libc/stdlib/strtod.c (_strtod_r): Revert change from 2011-05-16. 2012-12-19 10:16:00 +00:00
Corinna Vinschen 3595a9c789 * libc/stdlib/getopt.c (getopt_internal): Align handling of colon to
SUSv4 requirements.
	(__getopt_long_r): Fix formatting.
2012-10-16 19:11:48 +00:00
Corinna Vinschen b2bde18ba5 * libc/stdlib/btowc.c (btowc): Cast to avoid compiler warning.
* libc/search/hash_buf.c (__get_buf): Initialize local vars to avoid
	compiler warning.
	* libc/stdio/fgets.c (_fgets_r): Ditto.
	* libc/time/strftime.c (strftime): Ditto.
2012-08-10 15:21:57 +00:00
Corinna Vinschen 1f232abc89 Throughout, run newlib with -Wall -Werror option and fix bugs and
compiler warnings found this way.

	* libc/stdio/freopen.c (_freopen_r): Fix bug setting _flags.

	* libc/include/stdio.h (_rename): Define when building newlib.
	* libc/include/sys/signal.h (_kill): Ditto.
	* libc/include/sys/stat.h (_mkdir): Ditto.
	* libc/include/sys/time.h (_gettimeofday): Ditto.
	* libc/include/sys/times.h (_times): Ditto.
	* libc/include/sys/wait.h (_wait): Ditto.
	* libc/locale/lmessages.c (empty): Don't define for Cygwin.
	* libc/locale/lmonetary.c (cnv): Ditto.
	* libc/locale/nl_langinfo.c (nl_langinfo): Ditto for variable s.
	* libc/posix/collate.c: Throughout cast to avoid compiler warning.
	* libc/posix/engine.c (matcher): Initialize dp to avoid compiler
	warning.
	* libc/posix/glob.c: Disable on Cygwin.  Explain why.
	* libc/posix/regcomp.c: Fix "uninitialized" compiler warnings.
	(dissect): Deliberately silence gcc compiler warning.  Add comment to
	explain why.
	* libc/posix/wordexp.c (wordexp): Remove num_bytes variable since result
	is never used.
	* libc/posix/popen.c (popen): Ditto for variable last.
	* libc/reent/mkdirr.c: Include sys/stat.h.
	* libc/reent/renamer.c: Include stdio.h.
	* libc/search/hash.c:  Throughout use underscored variants of the stat
	function family.
	(init_hash): Add missing definition for the __USE_INTERNAL_STAT64 case.
	* libc/search/hash_bigkey.c (__big_insert): Add parenthesis to avoid
	compiler warning.
	* libc/search/hash_page.c (overflow_page): Initalize freep to NULL to
	avoid compiler warning.
	* libc/stdio/asiprintf.c (_asiprintf_r): Cast unsigned char * to char *
	to avoid compiler warning.
	(asiprintf): Ditto.
	* libc/stdio/asprintf.c (_asprintf_r): Ditto.
	(asprintf): Ditto.
	* libc/stdio/vasiprintf.c (_vasiprintf_r): Ditto.
	* libc/stdio/vasprintf.c (_vasprintf_r): Ditto.
	* libc/stdio/mktemp.c (_gettemp): Cast to unsigned char in call to
	isdigit to avoid compiler warning.
	* libc/stdio/vfprintf.c (_VFPRINTF_R): Initialize variables used for
	grouping to avoid compiler warning.  Only define and set nseps and
	nrepeats if they are really used.
	* libc/stdio/vfwprintf.c (_VFWPRINTF_R): Ditto.  Only define state if
	it is really used.
	* libc/stdio/vfscanf.c (u_char): Revert to be defined as unsigned char.
	(__SVFSCANF_R): Cast fmt in call to __mbtowc.
	* libc/stdlib/mbtowc_r.c (JIS_state_table): Disable when building
	Cygwin.
	(JIS_action_table): Ditto.
	* libc/stdlib/wctomb_r.c (__utf8_wctomb): Add parenthesis to avoid
	compiler warning.
	* libc/string/strcasestr.c: Deliberately silence gcc compiler warning.
	Add comment to explain why.
	* libc/time/strptime.c (strptime): Cast to unsigned char in calls to
	isspace to avoid compiler warning.
	* libm/math/e_atan2.c (__ieee754_atan2): Add parenthesis to avoid
	compiler warning.
	* libm/math/e_exp.c (__ieee754_exp): Initialize k to 0 to avoid
	compiler warning.  Drop setting it to 0 later.
	* libm/math/ef_exp.c (__ieee754_expf): Ditto.
	* libm/math/e_pow.c (__ieee754_pow): Add braces to avoid compiler
	warning.
	* libm/math/ef_pow.c (__ieee754_powf): Ditto.
	* libm/math/er_lgamma.c (__ieee754_lgamma_r): Initialize nadj to 0 to
	avoid compiler warning.
	* libm/math/erf_lgamma.c (__ieee754_lgammaf_r): Ditto.
	* libm/math/e_rem_pio2.c (__ieee754_rem_pio2): Ditto for variable z.
	* libm/common/sf_round.c (roundf): Remove signbit variable since result
	is never used.
2012-08-08 11:04:18 +00:00
Corinna Vinschen ba35b8303c * libc/stdlib/mprec.h (Storeinc): Add parenthesis to avoid compiler
warning.
2012-08-07 17:52:51 +00:00
Jeff Johnston 286625cf91 2012-01-03 Viachaslau Kulakouski <Viachaslau.Kulakouski@oracle.com>
* libc/stdlib/__atexit.c: Refer to __atexit_lock instead of lock.
2012-01-03 19:13:57 +00:00
Jeff Johnston e7c65aae83 2011-12-19 Jeff Johnston <jjohnstn@redhat.com>
* NEWS: Update with 1.20.0 info.
        * README: Ditto.
        * acinclude.m4: Change version number to 1.20.0.
        * aclocal.m4: Regenerated.
        * configure: Ditto.
        * Makefile.in: Regenerated.
        * doc/aclocal.m4: Ditto.
        * doc/configure: Ditto.
        * libc/*/aclocal.m4: Ditto.
        * libc/*/configure: Ditto.
        * libc/libc.texinfo: Ditto.
        * libm/*/aclocal.m4: Ditto.
        * libm/*/configure: Ditto.
        * libm/libm.texinfo: Ditto.
        * libc/sys/linux/shared.ld: Add VERS_1.20
2011-12-19 22:03:51 +00:00
Ralf Corsepius 1c5c40f638 2011-08-23 Ralf Corsépius <ralf.corsepius@rtems.org>
* libc/stdlib/putenv_r.c: Use "strchr" instead of obsolete "index".
	* libc/stdlib/setenv_r.c: Use "memcpy" instead of obsolete "bcopy".
2011-08-23 12:03:55 +00:00
Corinna Vinschen f783f223cb * libc/stdlib/strtod.c (_strtod_r): Fix nf/nd counts to not exceed
DBL_DIG.
2011-05-16 13:34:06 +00:00
Jeff Johnston 321b046c80 2010-12-16 Jeff Johnston <jjohnstn@redhat.com>
* NEWS: Update with 1.19.0 info.
        * README: Ditto.
        * MAINTAINERS: Update.
        * acinclude.m4: Change version number to 1.19.0.
        * aclocal.m4: Regenerated.
        * configure: Ditto.
        * Makefile.am: Fix stmp-targ-include target.
        * Makefile.in: Regenerated.
        * doc/aclocal.m4: Ditto.
        * doc/configure: Ditto.
        * libc/*/aclocal.m4: Ditto.
        * libc/*/configure: Ditto.
        * libc/libc.texinfo: Ditto.
        * libm/*/aclocal.m4: Ditto.
        * libm/*/configure: Ditto.
        * libm/libm.texinfo: Ditto.
        * libc/sys/linux/shared.ld: Add VERS_1.19
2010-12-16 21:59:17 +00:00
Jeff Johnston c317cb34b1 2010-12-07 Jeff Johnston <jjohnstn@redhat.com>
* libc/stdlib/strtod.c(_strtod_r): Fix code to handle case whereby
        _DOUBLE_IS_32BITS is set and DBL_DIGS is 6 instead of 15.
2010-12-07 21:26:45 +00:00
Jeff Johnston 9ef039777b 2010-10-27 Maurice Baijens <maurice.baijens@ellips.nl>
* libc/stdlib/strtol.c: Make sure signed characters are not
        sign-extended when converted to int and passed to ctype macros.
        * libc/stdlib/strtoul.c: Ditto.
        * libc/stdlib/strtoll_r.c: Ditto.
        * libc/stdlib/strtoull_r.c: Ditto.
2010-10-27 19:06:10 +00:00
Jeff Johnston 58d6976a6e 2010-06-08 Jeff Johnston <jjohnstn@redhat.com>
* configure.in: Add test for enable-newlib-register-fini
        to set the _WANT_REGISTER_FINI flag.
        * configure: Regenerated.
        * Makefile.in: Ditto.
        * newlib.hin: Add _WANT_REGISTER_FINI flag.
        * libc/stdlib/__call_atexit.c: Add test for
        _WANT_REGISTER_FINI to enable the register_fini function.
2010-06-08 18:44:14 +00:00
Jeff Johnston ced5f59df9 2010-06-04 Mark Mitchell <mark@codesourcery.com>
* libc/stdlib/__call_atexit.c (__libc_fini): Declare.
        (register_fini): New function.
        * libc/misc/init.c (_fini): Remove.
        (__libc_fini_array): Likewise.
        * libc/misc/fini.c: New file.
        * libc/misc/Makefile.am (LIB_SOURCES): Add fini.c.
        * libc/misc/Makefile.in: Regenerate.
2010-06-04 15:30:40 +00:00
Jeff Johnston 4f5feab5ea 2010-05-31 Kazu Hirata <kazu@codesourcery.com>
* libc/stdlib/mallocr.c (malloc_extend_top): Backport the
        difference between versions 2.6.4 and 2.6.5.
2010-05-31 19:15:41 +00:00
Jeff Johnston ca52bf1705 2010-05-11 Jeff Johnston <jjohnstn@redhat.com>
* libc/stdlib/__call_atexit.c: Fix lock to be of type
        _LOCK_RECURSIVE_T as recursive usage is needed.
2010-05-11 20:41:37 +00:00
Corinna Vinschen ffa42cf6a0 * libc/stdlib/wctob.c (wctob): Reorganize and fix WEOF check. Rename
pwc to pmb and convert to array to avoid buffer overflow.  Rename c to
	wc.  Check wc for WEOF instead of for EOF.  Return first byte of pmb if
	__wctomb conversion returned exactly one byte, EOF otherwise.
2010-05-02 11:55:01 +00:00
DJ Delorie 948214b000 * libc/Makefile.am (SUBDEFS): Add LIBC_POSIX_DEF.
(libc.info): Add posix.texi.
(libc.dvi): Likewise.
(stmp-posix): New.
(posix.texi): New.
(libc_TEXINFOS): Add posix.texi.
* libc/configure.in (LIBC_POSIX_LIB, LIBC_POSIX_DEF): Add
tests.
* libc/libc.texinfo: Include posix.texi
* libc/locale/locale.c: Fix texinfo typo.
* libc/time/strftime.c: Fix texinfo typo.

* libc/configure: Regenerate.
* libc/Makefile.in: Regenerate.
* libc/argz/Makefile.in: Regenerate.
* libc/ctype/Makefile.in: Regenerate.
* libc/errno/Makefile.in: Regenerate.
* libc/iconv/Makefile.in: Regenerate.
* libc/iconv/ccs/Makefile.in: Regenerate.
* libc/iconv/ccs/binary/Makefile.in: Regenerate.
* libc/iconv/ces/Makefile.in: Regenerate.
* libc/iconv/lib/Makefile.in: Regenerate.
* libc/locale/Makefile.in: Regenerate.
* libc/misc/Makefile.in: Regenerate.
* libc/posix/Makefile.in: Regenerate.
* libc/reent/Makefile.in: Regenerate.
* libc/search/Makefile.in: Regenerate.
* libc/signal/Makefile.in: Regenerate.
* libc/stdio/Makefile.in: Regenerate.
* libc/stdio64/Makefile.in: Regenerate.
* libc/stdlib/Makefile.in: Regenerate.
* libc/string/Makefile.in: Regenerate.
* libc/syscalls/Makefile.in: Regenerate.
* libc/time/Makefile.in: Regenerate.
* libc/unix/Makefile.in: Regenerate.
* libc/xdr/Makefile.in: Regenerate.
2010-04-22 23:32:42 +00:00
Jeff Johnston 5f46e4094f 2010-04-06 Dave Korn <dave.korn.cygwin@googlemail.com>
* libc/stdlib/__atexit.c (__atexit_lock): Initialise as recursive
        rather than non-recursive lock type.
        (__register_exitproc): Use recursive locking APIs on it.
        * libc/stdlib/__call_atexit.c (__call_exitprocs): Likewise.
2010-04-06 20:20:36 +00:00
Corinna Vinschen 65ee447a02 * libc/stdlib/btowc.c (btowc): Reorganize EOF check. Fix incorrect
return value if input byte is ASCII NUL.
2010-04-06 14:46:31 +00:00
Corinna Vinschen b73e65bb44 * libm/math/ef_sqrt.c: Delete unused variable sign.
* libc/stdlib/getenv.c: Delete "char *_findenv_r ();", as is not a
	proper prototype, and is properly prototyped in stdlib.h, anyway.
	* libc/stdlib/getenv_r.c: Ditto.
	* libc/search/hash.c: Add _DEFUN to __hash_open() declaration; add
	#define __DBINTERFACE_PRIVATE to activate prototypes from db_local.h.
	* libc/search/db_local.h: Correct __hash_open() prototype.
	* libc/sys/linux/cmath/math_private.h:  Eliminate compiler warnings:
	Remove #define INFINITY (redefines from math.h); remove #define __isnanf
	and #define __isinff isinff.
2010-03-05 08:55:16 +00:00
Corinna Vinschen 3d7c4998ac Add eXtensible Data Record (XDR) support
* configure.host: Build libc/xdr only on cygwin.
	* Makefile.am: Install xdr headers.
	* libc/configure.in: Support new libc/xdr subdirectory.
	* libc/Makefile.am: Support new libc/xdr subdirectory.
	* libc/include/rpc/types.h: New.
	* libc/include/rpc/xdr.h: New.
	* libc/xdr/README: New.
	* libc/xdr/Makefile.am: New.
	* libc/xdr/dummy.c: New.
	* libc/xdr/xdr.c: New.
	* libc/xdr/xdr_array.c: New.
	* libc/xdr/xdr_float.c: New.
	* libc/xdr/xdr_float_vax.c: New.
	* libc/xdr/xdr_mem.c: New.
	* libc/xdr/xdr_private.c: New.
	* libc/xdr/xdr_private.h: New.
	* libc/xdr/xdr_rec.c: New.
	* libc/xdr/xdr_reference.c: New.
	* libc/xdr/xdr_sizeof.c: New.
	* libc/xdr/xdr_stdio.c: New.

	Regenerate using ac-2.63 and am-1.11.1
	* libc/xdr/Makefile.in: New.
	* Makefile.in: Regenerate.
	* libc/configure: Regenerate.
	* libc/Makefile.in: Regenerate.
	* libc/argz/Makefile.in: Regenerate.
	* libc/ctype/Makefile.in: Regenerate.
	* libc/errno/Makefile.in: Regenerate.
	* libc/iconv/ccs/binary/Makefile.in: Regenerate.
	* libc/iconv/ccs/Makefile.in: Regenerate.
	* libc/iconv/ces/Makefile.in: Regenerate.
	* libc/iconv/lib/Makefile.in: Regenerate.
	* libc/iconv/Makefile.in: Regenerate.
	* libc/locale/Makefile.in: Regenerate.
	* libc/misc/Makefile.in: Regenerate.
	* libc/posix/Makefile.in: Regenerate.
	* libc/reent/Makefile.in: Regenerate.
	* libc/search/Makefile.in: Regenerate.
	* libc/signal/Makefile.in: Regenerate.
	* libc/stdio/Makefile.in: Regenerate.
	* libc/stdio64/Makefile.in: Regenerate.
	* libc/stdlib/Makefile.in: Regenerate.
	* libc/string/Makefile.in: Regenerate.
	* libc/syscalls/Makefile.in: Regenerate.
	* libc/time/Makefile.in: Regenerate.
	* libc/unix/Makefile.in: Regenerate.
2010-03-02 12:05:18 +00:00
Jeff Johnston 9035cfbd12 2010-02-24 Charles Wilson <...>
Work around issues with new libtool files in ..
        * configure.in: Unconditionally call _LT_PROG_ECHO_BACKSLASH.
        * iconvdata/configure.in: Ditto.
        * libc/configure.in: Ditto.
        * libc/machine/configure.in: Ditto.
        * libc/machine/i386/configure.in: Ditto.
        * libc/sys/configure.in: Ditto.
        * libc/sys/linux/configure.in: Ditto.
        * libc/sys/linux/linuxthreads/configure.in: Ditto.
        * libc/sys/linux/linuxthreads/machine/configure.in: Ditto.
        * libc/sys/linux/linuxthreads/machine/i386/configure.in: Ditto.
        * libc/sys/linux/machine/configure.in: Ditto.
        * libc/sys/linux/machine/i386/configure.in: Ditto.
        * libm/configure.in: Ditto.
        * libm/machine/configure.in: Ditto.
        * libm/machine/i386/configure.in: Ditto.
        * libc/machine/sh/configure.in: Ditto.  Also, call
        AC_NO_EXECUTABLES before NEWLIB_CONFIGURE.
        * aclocal.m4: Regenerated.
        * configure: Ditto.
        * Makefile.in: Ditto.
        * doc/aclocal.m4: Ditto.
        * doc/Makefile.in: Ditto.
        * libc/*/aclocal.m4: Ditto.
        * libc/*/Makefile.in: Ditto.
        * libc/*/configure: Ditto.
        * libm/*/aclocal.m4: Ditto.
        * libm/*/Makefile.in: Ditto.
        * libm/*/configure: Ditto.
2010-02-24 21:00:08 +00:00
Jeff Johnston ba7b214766 2010-02-24 Jeff Johnston <jjohnstn@redhat.com>
* libc/stdlib/__call_exit.c: Add include of sys/lock.h.
2010-02-24 19:58:17 +00:00
Corinna Vinschen 5eb556c849 * libc/ctype/ctype_cp.h (_CTYPE_GEORGIAN_PS_128_254): Define.
(_CTYPE_GEORGIAN_PS_255): Define.
	(_CTYPE_PT154_128_254): Define.
	(_CTYPE_PT154_255): Define.
	(__ctype_cp): Add array members for above ctype definitions.
	* libc/locale/locale.c (loadlocale): Make TIS-620 charset name
	available for all targets.  Add guards for setting the conversion
	function pointers.  Add support for GEORGIAN-PS and PT154 charsets.
	Change documentation to reflect current behaviour more closely.
	* libc/locale/nl_langinfo.c (nl_langinfo): On Cygwin, translate
	"CP101" to "GEORGIAN-PS" and "CP102" to "PT154".
	* libc/stdlib/sb_charsets.c (__cp_conv): Add conversion arrays
	for GEORGIAN-PS and PT154.
	(__cp_index): Map invalid Windows codepage number 101 to
	GEORGIAN-PS conversion array, 102 to PT154 conversion array.
2010-02-06 18:28:33 +00:00
Christopher Faylor fa40bd922e * libc/stdlib/__atexit.c (__atexit_lock): Define a global lock for atexit
functions.
(__register_exitproc): Use __atexit_lock rather than a local static lock.
* libc/stdlib/__call_atexit.c: Ditto.
2010-02-04 17:57:30 +00:00
Jeff Johnston 2d69f00e6e 2010-01-29 Jeff Johnston <jjohnstn@redhat.com>
* libc/search/Makefile.am: Create .def files for bsearch and qsort.
        * libc/search/Makefile.in: Regenerated.
        * libc/stdlib/stdlib.tex: Add bsearch and qsort.
2010-01-29 23:04:21 +00:00
Corinna Vinschen 8c72ebb7e0 * libc/stdlib/wcstombs_r.c (_wcstombs_r): Handle invalid characters
correctly also in the s==NULL case.
2010-01-19 21:14:53 +00:00
Corinna Vinschen 32cb8c8cfe * libc/locale/locale.c (lc_ctype_charset): Disable defaulting to
"UTF-8" on Cygwin.
	(lc_message_charset): Ditto.
	(loadlocale): Disable setting charset of the "C" locale to "UTF-8" on
	Cygwin.
	* libc/stdlib/mbtowc_r.c (__mbtowc): Add Cygwin-specific comment.
	* libc/stdlib/wctomb_r.c (__wctomb): Ditto.
2010-01-17 09:39:06 +00:00
Corinna Vinschen 2b77087a48 * libc/stdlib/mbtowc_r.c (__ascii_mbtowc): Disallow conversion of
non-ASCII chars on Cygwin.
	* libc/stdlib/wctomb_r.c (__ascii_wctomb): Ditto.
2010-01-10 13:54:34 +00:00
Jeff Johnston 8b917fbcdd 2009-12-17 Jerker Back <jerker.back@gmail.com>
* libc/include/_ansi.h: Add new _EXFNPTR macro for using with
        function pointer arguments.
        * libc/iconv/lib/conv.h: Use _EXFNPTR rather than _EXPARM macro.
        * libc/iconv/lib/ucsconv.h: Ditto.
        * libc/include/stdlib.h: Use new _EXFNPTR macro for function pointers.
        * libc/include/sys/reent.h: Ditto.
        * libc/include/sys/unistd.h: Ditto.
        * libc/search/bsearch.c: Ditto.
        * libc/stdio/fseek.c: Ditto.
        * libc/stdio64/fseeko64.c: Ditto.
        * libc/stdlib/atexit.c: Ditto.
        * libc/stdlib/on_exit.c: Ditto.
2009-12-17 19:43:43 +00:00
Jeff Johnston df8d921e12 2009-12-03 Craig Howland <howland@LGSInnovations.com>
* libc/stdlib/strtod.c:  Correct "NO_REENT" to "_REENT_ONLY".
        * libc/stdlib/wcstod.c:  Ditto.
        * libc/stdlib/dtoastub.c:  Ditto.
2009-12-03 16:11:27 +00:00
Corinna Vinschen e92d0abecf Use NetBSD fix for CVE-2009-0689 security vulnerability.
* libc/include/sys/reent.h (_Kmax): Define here based on the sizeof
	size_t, as in latest NetBSD.
	* libc/reent/reent.c (_reclaim_reent): Use _Kmax rather than constant
	value 15.
	* libc/stdlib/mprec.c (_Kmax): Don't define here.  Explain why.
2009-11-23 17:02:20 +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 3a2f070f31 2009-10-20 Jeff Johnston <jjohnstn@redhat.com>
* configure.host: Don't set -O2 flag in newlib_cflags.  Leave
        that to CFLAGS.
        * acinclude.m4: Don't reset CFLAGS before calling _AC_PROG_CC_G
        as it sets the same flags as we are using.
        * aclocal.m4: Regenerated.
        * configure: Ditto.
        * Makefile.in: Ditto.
        * iconvdata/aclocal.m4: Ditto.
        * iconvdata/configure: Ditto.
        * iconvdata/Makefile.in: Ditto.
        * doc/aclocal.m4: Ditto.
        * doc/configure: Ditto.
        * doc/Makefile.in: Ditto.
        * libc/aclocal.m4: Ditto.
        * libc/configure: Ditto.
        * libc/Makefile.in: Ditto.
        * libc/*Makefile.in: Ditto.
        * libc/*aclocal.m4: Ditto.
        * libc/*configure: Ditto.
        * libm/*Makefile.in: Ditto.
        * libm/*aclocal.m4: Ditto.
        * libm/*configure: Ditto.
2009-10-20 22:44:28 +00:00
Jeff Johnston a3a62ae7a5 2009-10-08 Jeff Johnston <jjohnstn@redhat.com>
* configure.host: For RTEMS, define HAVE_ASSERT_FUNC.
        * libc/stdlib/assert.c (_assert_func): Do not specify
        __assert_func if HAVE_ASSERT_FUNC flag is set.
2009-10-08 16:44:10 +00:00
Corinna Vinschen 6ff28fc3b1 * libc/stdlib/mbtowc_r.c (__utf8_mbtowc): Allow CESU-8 surrogate
value encoding.
	* libc/stdlib/wctomb_r.c (__utf8_mbtowc): Allow CESU-8 surrogate
	value decoding.
2009-10-03 08:51:07 +00:00
Corinna Vinschen 99dbad651c * libc/stdlib/sb_charsets.c: Throughout, translate undefined
characters to their corresponding Windows Unicode value.
2009-09-29 19:11:01 +00:00
Jeff Johnston 6c249577fb 2009-09-28 Michael Eager <eager@eagercon.com>
* configure.host: Add microblaze.
        * libc/include/machine/ieeefp.h [MICROBLAZE]: Define __IEEE_BIG_ENDIAN.
        * libc/include/machine/setjmp.h [MICROBLAZE]: Define _JBLEN, _JBTYPE.
        * libc/include/sys/config.h [MICROBLAZE]: Define _REENT_SMALL,
        _UNIX98_THREAD_MUTEX_ATTRIBUTES.
        * libc/include/sys/types.h: Treat XMK like rtems, define
        PTHREAD_MUTEX_NORMAL, PTHREAD_MUTEX_ERRORCHECK, PTHREAD_MUTEX_RECURSIVE,
        PTHREAD_MUTEX_DEFAULT, PTHREAD_STACK_MIN, define stuct pthread_attr_s.
        * libc/machine/configure.in: Add microblaze.
        * libc/machine/configure: Add microblaze (not regenerated).
        * libc/machine/microblaze/configure.in: NEW.
        * libc/machine/microblaze/configure: Generate.
        * libc/machine/microblaze/Makefile.am: NEW.
        * libc/machine/microblaze/Makefile.in: Generate.
        * libc/machine/microblaze/{abort.c, strcmp.c, strcpy.c, strlen.c,
        mallocr.c, longjmp.S, setjmp.S}: NEW.
        * libc/stdlib/mallocr.c [MICROBLAZE]: Don't declare sbrk prototype,
        mALLOc(): return malloc value.
2009-09-28 16:42:21 +00:00
Corinna Vinschen a58d484bcf * libc/locale/locale.c (lc_ctype_charset): Set to "UTF-8" on Cygwin.
(lc_message_charset): Ditto.
	(loadlocale): Set charset of the "C" locale to "UTF-8" on Cygwin.
	* libc/stdlib/mbtowc_r.c (__mbtowc): Default to __utf8_mbtowc on
	Cygwin.
	* libc/stdlib/wctomb_r.c (__wctomb): Default to __utf8_wctomb on
	Cygwin.
2009-09-27 12:21:16 +00:00
Jeff Johnston eb9194f52c 2009-08-25 Andy Koppe <andy.koppe@gmail.com>
* libc/stdlib/sb_charsets.c (__micro_atoi): Allow five-digit codepage
        numbers.
        * libc/locale/locale.c (loadlocale): Set MB_CUR_MAX to 1 for KOI8
        charsets.
        * libc/stdlib/local.h (__cp_conv): Remove incorrect number of codepages.
2009-08-25 18:47:24 +00:00
Jeff Johnston 162a23c504 2009-08-24 Corinna Vinschen <corinna@vinschen.de>
* libc/locale/locale.c: Update documentation.
        (loadlocale): Map "KOI8-R" and "KOI8-U" to CP20866 and CP21866.

2009-08-24  Andy Koppe  <andy.koppe@gmail.com>

        * libc/stdlib/sb_charsets.c (__cp_conv): Add KOI8-R (Russian, CP20866)
        and KOI8-U (Ukrainian, CP21866) to Windows codepage conversion tables.
        * libc/ctype/ctype_cp.h (__ctype_cp): Likewise for ctype tables.
2009-08-24 22:11:11 +00:00
Jeff Johnston 5f8c90bbc0 2009-08-10 Jeff Johnston <jjohnstn@redhat.com>
* libc/stdlib/wcstombs.c: Change documentation to specify size_t
        return type instead of int.
2009-08-10 16:23:20 +00:00
Jeff Johnston 1cc1af42c1 2009-07-29 Jeff Johnston <jjohnstn@redhat.com>
* libc/stdlib/a64l.c: Fix to use 'a' instead of 'A' in calculation
        when a lower-case character is detected.
2009-07-29 22:33:40 +00:00
Corinna Vinschen a67f77af1a * libc/stdlib/mbtowc_r.c (__utf8_mbtowc): Rework UTF-16 surrogate
pair handling to be more bullet-proof even with incomplete UTF-8
	sequences.  Add check for 4 byte sequences resulting in values
	outside the valid Unicode range.  Add a comment to clarify checking
	for invalid CESU-8 sequences.
2009-07-29 08:31:30 +00:00
Corinna Vinschen ecf5c883df * libc/stdlib/mbtowc_r.c (__utf8_mbtowc): Fix incrementing n in case
of handling incomplete sequences.
2009-07-28 16:49:19 +00:00
Corinna Vinschen 1c5e84dd08 * libc/stdio/vfprintf.c (_VFPRINTF_R): Use actual length of
radix char instead of assuming length 1.
	* libc/stdlib/gdtoa-gethex.c: Remove use of USE_LOCALE.
	(gethex): Allow multibyte decimal point.
	Fix compiler warnings due to different signedness of pointer types.
	* libc/stdlib/strtod.c: Remove use of USE_LOCALE.
	(_strtod_r): Allow multibyte decimal point.
	* libc/stdlib/wcstod.c (_wcstod_r): Evaluate correct wide char
	endptr position if the decimal point is a multibyte char.
2009-06-16 17:44:20 +00:00
Jeff Johnston 1a99b6f85a 2009-06-16 Craig Howland <howland@LGSInnovations.com>
* libc/ctype/local.h (__locale_charset): Add arguments to
        prototype
        * libc/stdlib/local.h (__locale_charset): Ditto.
2009-06-16 16:02:07 +00:00
Jeff Johnston 35f31b6a98 2009-04-24 Jeff johnston <jjohnstn@redhat.com>
* configure.in: Add configuration test for long double equals dbl
        and set flag _LDBL_EQ_DBL if true.
        * configure: Regenerated.
        * newlib.hin: Add _LDBL_EQ_DBL flag.
        * libc/include/math.h: Use _LDBL_EQ_DBL flag instead of
        _HAVE_LDBL_MATH.
        * libc/include/stdlib.h: Use _LDBL_EQ_DBL flag instead of
        _HAVE_LDBL_STDLIB.
        * libc/common/local.h: Remove _LDBL_EQ_DBL flag setting.
        * libc/stdlib/local.h: Ditto.
2009-04-24 22:49:55 +00:00
Jeff Johnston bbb9d4fde3 2009-04-23 Paul Brook <paul@codesourcery.com>
Kazu Hirata  <kazu@codesourcery.com>

        * libc/stdlib/__atexit.c (__register_exitproc): Use weak reference
        to malloc.  Allocate dynamically only if it is present.
        * libc/stdlib/__call_atexit.c (__call_exitprocs): Use weak
        reference to free.  Call free only if it is present.
2009-04-23 17:54:22 +00:00
Corinna Vinschen 755b125b77 * libc/stdio/local.h (__chclass, __state_table, __action_table):
Add extern to the declarations.
	* libc/stdlib/local.h (__iso_8859_conv, __cp_conv): Likewise.
2009-04-22 08:30:03 +00:00
Jeff Johnston 1b8e360e06 2009-04-17 Jeff johnston <jjohnstn@redhat.com>
* libc/include/machine/ieeefp.h (_LDBL_EQ_DBL): Remove.
        * libc/stdlib/local.h (_LDBL_EQ_DBL): Add.
        * libc/stdlib/strtold.c: Include local.h.
        * libc/stdlib/wcstold.c: Likewise.
        * libm/common/atanl.c: Likewise.
        * libm/common/cosl.c: Likewise.
        * libm/common/sinl.c: Likewise.
        * libm/common/modfl.c: Likewise.
        * libm/common/frexpl.c: Likewise.
        * libm/common/tanhl.c: Likewise.
        * libm/common/tanl.c: Likewise.
        * libm/common/expm1l.c: Likewise.
        * libm/common/log1pl.c: Likewise.
        * libm/common/ceill.c: Likewise.
        * libm/common/fabsl.c: Likewise.
        * libm/common/floorl.c: Likewise.
        * libm/common/acosl.c: Likewise.
        * libm/common/asinl.c: Likewise.
        * libm/common/atan2l.c: Likewise.
        * libm/common/coshl.c: Likewise.
        * libm/common/expl.c: Likewise.
        * libm/common/fmodl.c: Likewise.
        * libm/common/hypotl.c: Likewise.
        * libm/common/ldexpl.c: Likewise.
        * libm/common/log10l.c: Likewise.
        * libm/common/logl.c: Likewise.
        * libm/common/powl.c: Likewise.
        * libm/common/sqrtl.c: Likewise.
        * libm/common/copysignl.c: Likewise.
        * libm/common/ilogbl.c: Likewise.
        * libm/common/nanl.c: Likewise.
        * libm/common/cbrtl.c: Likewise.
        * libm/common/asinhl.c: Likewise.
        * libm/common/nextafterl.c: Likewise.
        * libm/common/rintl.c: Likewise.
        * libm/common/scalbnl.c: Likewise.
        * libm/common/exp2l.c: Likewise.
        * libm/common/fdiml.c: Likewise.
        * libm/common/fmal.c: Likewise.
        * libm/common/fmaxl.c: Likewise.
        * libm/common/fminl.c: Likewise.
        * libm/common/lrintl.c: Likewise.
        * libm/common/lroundl.c: Likewise.
        * libm/common/nearbyintl.c: Likewise.
        * libm/common/remquol.c: Likewise.
        * libm/common/roundl.c: Likewise.
        * libm/common/scalblnl.c: Likewise.
        * libm/common/truncl.c: Likewise.
        * libm/common/acoshl.c: Likewise.
        * libm/common/atanhl.c: Likewise.
        * libm/common/erfcl.c: Likewise.
        * libm/common/erfl.c: Likewise.
        * libm/common/lgammal.c: Likewise.
        * libm/common/remainderl.c: Likewise.
        * libm/common/tgammal.c: Likewise.
        * libm/common/sinhl.c: Likewise.
        * libm/common/llroundl.c: Likewise.
        * libm/common/llrintl.c: Likewise.
        * libm/common/local.h: New file with _LDBL_EQ_DBL macro.
2009-04-17 22:15:43 +00:00
Jeff Johnston 65f414dc16 2009-04-16 Ken Werner <ken.werner@de.ibm.com>
* libm/libm.texinfo: Add long double function support chapter.
        * libc/include/machine/ieeefp.h: Add _LDBL_EQ_DBL define.
        * libc/include/stdlib.h: Include <machine/ieeefp.h>.
        (strtold, wcstold): Declare.
        * libc/stdlib/strtold.c: New File.
        * libc/stdlib/wcstold.c: Likewise.
        * libc/configure.in: Add long double check.
        * libc/configure: Regenerate.
        * libc/stdlib/Makefile.am: Add strtold.c and wcstold.c.
        * libc/stdlib/Makefile.in: Regenerate.
        * libc/include/math.h (atanl, cosl, sinl, tanl, tanhl): Declare.
        (frexpl, modfl, ceill, fabsl, floorl, log1pl, expm1l, acosl): Ditto.
        (asinl, atan2l, coshl, sinhl, expl, ldexpl, logl, log10l, powl): Ditto.
        (sqrtl, fmodl, hypotl, copysignl, nanl, ilogbl, asinhl, cbrt): Ditto.
        (nextafterl, rintl, scalbnl, exp2l, scalblnl, tgammal): Ditto.
        (nearbyintl, lrintl, llrintl, roundl, lroundl, llround): Ditto.
        (llroundl, truncl, remquol, fdiml, fmaxl, fminl, fmal, acoshl): Ditto.
        (atanhl, remainderl, lgammal, erfl, erfcl): Ditto.
        * libm/common/atanl.c: New File.
        * libm/common/cosl.c: Likewise.
        * libm/common/sinl.c: Likewise.
        * libm/common/modfl.c: Likewise.
        * libm/common/frexpl.c: Likewise.
        * libm/common/tanhl.c: Likewise.
        * libm/common/tanl.c: Likewise.
        * libm/common/expm1l.c: Likewise.
        * libm/common/log1pl.c: Likewise.
        * libm/common/ceill.c: Likewise.
        * libm/common/fabsl.c: Likewise.
        * libm/common/floorl.c: Likewise.
        * libm/common/acosl.c: Likewise.
        * libm/common/asinl.c: Likewise.
        * libm/common/atan2l.c: Likewise.
        * libm/common/coshl.c: Likewise.
        * libm/common/expl.c: Likewise.
        * libm/common/fmodl.c: Likewise.
        * libm/common/hypotl.c: Likewise.
        * libm/common/ldexpl.c: Likewise.
        * libm/common/log10l.c: Likewise.
        * libm/common/logl.c: Likewise.
        * libm/common/powl.c: Likewise.
        * libm/common/sqrtl.c: Likewise.
        * libm/common/copysignl.c: Likewise.
        * libm/common/ilogbl.c: Likewise.
        * libm/common/nanl.c: Likewise.
        * libm/common/cbrtl.c: Likewise.
        * libm/common/asinhl.c: Likewise.
        * libm/common/nextafterl.c: Likewise.
        * libm/common/rintl.c: Likewise.
        * libm/common/scalbnl.c: Likewise.
        * libm/common/exp2l.c: Likewise.
        * libm/common/fdiml.c: Likewise.
        * libm/common/fmal.c: Likewise.
        * libm/common/fmaxl.c: Likewise.
        * libm/common/fminl.c: Likewise.
        * libm/common/lrintl.c: Likewise.
        * libm/common/lroundl.c: Likewise.
        * libm/common/nearbyintl.c: Likewise.
        * libm/common/remquol.c: Likewise.
        * libm/common/roundl.c: Likewise.
        * libm/common/scalblnl.c: Likewise.
        * libm/common/truncl.c: Likewise.
        * libm/common/acoshl.c: Likewise.
        * libm/common/atanhl.c: Likewise.
        * libm/common/erfcl.c: Likewise.
        * libm/common/erfl.c: Likewise.
        * libm/common/lgammal.c: Likewise.
        * libm/common/remainderl.c: Likewise.
        * libm/common/tgammal.c: Likewise.
        * libm/common/sinhl.c: Likewise.
        * libm/common/llroundl.c: Likewise.
        * libm/configure.in: Add long double check.
        * libm/configure: Regenerate.
        * libm/common/Makefile.am: Add new files.
        * libm/common/Makefile.in: Regenerate.
2009-04-16 18:24:35 +00:00
Corinna Vinschen 9b26525ec3 * libc/stdlib/local.h (__mbtowc): Declare extern.
(__wctomb): Ditto.
2009-04-09 08:24:37 +00:00
Corinna Vinschen f03f51dccf * libc/stdlib/mbctype.h (_iseucjp1): Like _iseucjp, but also
recognizes 0x8e and 0x8f lead bytes.
	(_iseucjp2): Rename from _iseucjp.
	* libc/stdlib/mbtowc_r.c (__eucjp_mbtowc): Convert JIS-X-0212
	triplebyte sequences as well.
	* libc/stdlib/wctomb_r.c (__eucjp_wctomb): Convert to JIS-X-0212
	triplebyte sequences as well.
2009-04-09 08:20:10 +00:00
Corinna Vinschen 80317fe50f * libc/stdlib/wcstombs.c: Fix datatypes in documentation. 2009-04-04 16:00:31 +00:00
Corinna Vinschen f6e29e076a Revert erroneously checked in files. 2009-03-26 10:04:40 +00:00
Corinna Vinschen 28186e81d9 * libc/ctype/iswalpha.c: Handle all wchar_t as unicode on
_MB_CAPABLE systems.
	* libc/ctype/iswblank.c: Ditto.
	* libc/ctype/iswcntrl.c: Ditto.
	* libc/ctype/iswprint.c: Ditto.
	* libc/ctype/iswpunct.c: Ditto.
	* libc/ctype/iswspace.c: Ditto.
	* libc/ctype/jp2uc.c (__jp2uc): On Cygwin, just return c.
	Explain why.
	* libc/ctype/towlower.c: Ditto.
	* libc/ctype/towupper.c: Ditto.
	* libc/include/sys/config.h: Define _MB_EXTENDED_CHARSETS_ISO
	and _MB_EXTENDED_CHARSETS_WINDOWS if _MB_EXTENDED_CHARSETS_ALL is
	defined.  Define _MB_EXTENDED_CHARSETS_ALL on Cygwin only for now.
	* libc/include/sys/reent.h (struct _reent): Mark _current_category
	and _current_locale as unused.
	* libc/locale/locale.c: Add new charset support to documentation.
	Include ../stdio/local.h from here.
	(lc_ctype_charset): Set to "ASCII" by default.
	(lc_message_charset): Ditto.
	(_setlocale_r): Don't set _current_category and _current_locale.
	(loadlocale): Add Cygwin codepage support.  On _MB_CAPABLE
	systems, set __mbtowc and __wctomb function pointers to function
	corresponding with current charset.  Don't allow non-existant
	ISO-8859-12 charset.  Add support for Windows singlebyte codepages.
	On Cygwin, add support for GBK, CP949, and BIG5.  On Cygwin,
	call __set_ctype() in case the catorgy is LC_CTYPE.  Don't set
	_current_category and _current_locale.
	* libc/stdlib/Makefile.am (GENERAL_SOURCES): Add sb_charsets.c.
	* libc/stdlib/Makefile.in: Regenerate.
	* libc/stdlib/local.h: Add prototype for __locale_charset.
	Add prototypes for __mbtowc and __wctomb pointers.
	Add prototypes for charset-specific _wctomb_r and _mbtowc_r
	functions.
	Declare tables and functions from sb_charsets.c.
	* libc/stdlib/mbtowc_r.c (__mbtowc): Define.  Set to __ascii_mbtowc
	by default.
	(_mbtowc_r): Just call __mbtowc from here.
	(__ascii_mbtowc): New function.
	(__iso_mbtowc): New function.
	(__cp_mbtowc): New function.
	(__utf8_mbtowc): New function.
	(__sjis_mbtowc): New function.  Disable on Cygwin.
	(__eucjp_mbtowc): New function.  Disable on Cygwin.
	(__jis_mbtowc): New function.  Disable on Cygwin.
	* libc/stdlib/sb_charsets.c: New file, adding singlebyte to UTF
	conversion tables for all ISO and CP charsets.
	(__iso_8859_index): New function.
	(__cp_index): New function.
	* libc/stdlib/wctomb_r.c (__wctomb): Define.  Set to __ascii_wctomb
	by default.
	(_wctomb_r): Just call __wctomb from here.
	(__ascii_wctomb): New function.
	(__utf8_wctomb): New function.
	(__sjis_wctomb): New function.  Disable on Cygwin.
	(__eucjp_wctomb): New function.  Disable on Cygwin.
	(__jis_wctomb): New function.  Disable on Cygwin.
	(__iso_wctomb): New function.
	(__cp_wctomb): New function.
2009-03-24 10:13:27 +00:00
Corinna Vinschen 360dc06fdb * libc/stdlib/mbtowc_r.c (_mbtowc_r): Return EILSEQ in case of an
invalid character sequence.

	* libc/stdlib/mbtowc_r.c (_mbtowc_r): Fix compiler warning due to
	missing declaration of __locale_charset.
	* libc/stdlib/wctomb_r.c (_wctomb_r): Ditto.
2009-03-19 19:47:52 +00:00
Corinna Vinschen d99179dbf3 * libc/stdlib/mbstowcs_r.c (_mbstowcs_r): Handle NULL destination
string correctly.
2009-03-17 12:16:28 +00:00
Corinna Vinschen d6cd9169dc * libc/locale/locale.c (_setlocale_r): New implementation based on
FreeBSD's setlocale.
	(currentlocale): New helper function.
	(loadlocale): Ditto.
	(__locale_charset): New function.
	(__locale_msgcharset): Rename from __locale_charset.
	* libc/ctype/local.h (__lc_ctype): Remove declaration.
	(__locale_charset): Declare.
	* libc/ctype/iswalpha.c (iswalpha): Call __locale_charset instead of
	using __lc_ctype directly.  Only compare against the charset alone.
	* libc/ctype/iswblank.c (iswblank): Ditto.
	* libc/ctype/iswcntrl.c (iswcntrl): Ditto.
	* libc/ctype/iswprint.c (iswprint): Ditto.
	* libc/ctype/iswpunct.c (iswpunct): Ditto.
	* libc/ctype/iswspace.c (iswspace): Ditto.
	* libc/ctype/towlower.c (towlower): Ditto.
	* libc/ctype/towupper.c (towupper): Ditto.
	* libc/stdlib/mbtowc_r.c (_mbtowc_r): Ditto.
	* libc/stdlib/wctomb_r.c (_wctomb_r): Ditto.
	* libc/sys/linux/intl/loadmsgcat.c (_nl_init_domain_conv): Call
	__locale_msgcharset instead of __locale_charset.
2009-03-03 09:28:45 +00:00
Jeff Johnston 95d85fcb1a 2009-03-02 Jeff Johnston <jjohnstn@redhat.com>
* libc/stdlib/wctomb_r.c (_wctomb_r): When checking single-byte
        charset, cast wchar to size_t in case wchar_t is signed.
        * libc/stdlib/wctomb.c (wctomb): Add similar single-byte check.
2009-03-02 23:30:59 +00:00
Jeff Johnston 49b09e5afa 2009-03-02 Corinna Vinschen <corinna@vinschen.de>
* libc/stdlib/wctomb_r.c (_wctomb_r): Return EILSEQ in case of an
        invalid wchar.  Return -1 if wchar doesn't fit into singlebyte
        value in case of using a singlebyte charset.
2009-03-02 23:20:28 +00:00
Jeff Johnston 297367e3b3 2009-02-25 Brooks Moses <brooks@codesourcery.com>
* libc/stdlib/Makefile.am (CHEWOUT_FILES): Add
          mbsnrtowcs.def, wcsnrtombs.def.
        * libc/stdlib/Makefile.in: Regenerate.
        * libc/stdlib/stdlib.tex (@menu): Use correct section
          names for mbsrtowcs, wcsrtombs.
        * libc/stdlib/wcstod.c: Remove stray character in
          documentation.
2009-02-25 21:33:18 +00:00
Corinna Vinschen 8d8bf5a5e2 * mbtowc_r.c (_mbtowc_r): Remove conversion of 5 and 6 byte UTF-8
sequences since they are invalid in the Unicode standard.
	Handle surrogate pairs in case of wchar_t == UTF-16.
	* wctomb_r.c (_wctomb_r): Don't convert invalid Unicode wchar_t
	values beyond 0x10ffff into UTF-8 chars.  Handle surrogate pairs in
	case of wchar_t == UTF-16.
2009-02-25 09:10:09 +00:00
Corinna Vinschen 2e10d61ccb * libc/include/wchar.h (mbsnrtowcs): Declare.
(_mbsnrtowcs_r): Declare.
	(wcsnrtombs): Declare.
	(_wcsnrtombs_r): Declare.
	* libc/stdlib/Makefile.am (ELIX_2_SOURCES): Add mbsnrtowcs.c
	and wcsnrtombs.c.
	* libc/stdlib/Makefile.in: Regenerate.
	* libc/stdlib/mbsnrtowcs.c: New file, implementing _mbsnrtowcs_r
	and mbsnrtowcs.  Document mbsnrtowcs and mbsrtowcs.
	* libc/stdlib/mbsrtowcs.c (_mbsrtowcs_r): Just call _mbsnrtowcs_r.
	(mbsrtowcs): Ditto.
	* libc/stdlib/wcsnrtombs.c: New file, implementing _wcsnrtombs_r
	and wcsnrtombs.  Document wcsrtombs and wcsnrtombs.
	* libc/stdlib/wcsrtombs.c (_wcsrtombs_r): Just call _wcsnrtombs_r.
	(wcsrtombs): Ditto.
	* libc/stdlib/stdlib.tex: Accommodate new documentation.
2009-02-19 09:19:42 +00:00
Jeff Johnston 3f60f7e544 2009-02-18 Jeff Johnston <jjohnstn@redhat.com>
* libc/stdio/open_memstream.c (internal_open_memstream_r): Fix max
        buffer size to be in wchar_t units if wide == 1 is passed in.  In
        this case, also initialize the first character of the buffer to be
        wide char null.
        (_open_wmemstream_r): Cast buf to be (char **) to avoid warning.
        * libc/stdlib/mbtowc_r.c (_mbtowc_r): Change all occurences of
        incrementing the size_t value n to first check that n is not already
        size_t -1.  Fix some compiler warnings.
        * libc/stdlib/wcstod.c: Add includes for <wctype.h> and <math.h>.
2009-02-18 21:28:41 +00:00
Jeff Johnston 77ea728b96 2009-02-12 Corinna Vinschen <corinna@vinschen.de>
* libc/include/wchar.h (_wcstod_r): Declare.
        (_wcstof_r): Declare.
        (wcstod): Declare.
        (wcstof): Declare.
        * libc/stdlib/Makefile.am (GENERAL_SOURCES): Add wcstod.c.
        (CHEWOUT_FILES): Add wcstod.def.
        * libc/stdlib/Makefile.in: Regenerate.
        * libc/stdlib/stdlib.tex: Add wcstod.
        * libc/stdlib/wcstod.c: New file.
2009-02-12 23:10:01 +00:00
Jeff Johnston 7dd0c33097 2008-12-11 Craig Howland <howland@LGSInnovations.com>
* libc/include/sys/lock.h:  Add void cast to avoid "statement has no
        effect" warnings from gcc.
        * libc/include/sys/stdio.h:  Ditto.
        * libc/include/sys/time.h:  Correct gettimeofday() prototype.
        * libc/stdlib/__exp10.c:  Add #include "std.h" for function prototype.
        * libc/stdlib/__ten_mu.c:  Ditto.
        * libc/stdlib/std.h:  Correct __exp10's ANSI prototype.
        * libc/stdlib/ldtoa.c:  Change eiisinf definition to ANSI form.  (Are
        already others in file without _ansi method, so did not bother.)
        * libc/stdlib/system.c:  Use _ansi forms for function prototypes and
        definitions.
        * libc/time/mktime.c:  Ditto.
        * libc/misc/__dprintf.c:  Ditto.
        * libc/include/stdio.h:  Add function prototypes for _fgetc_r,
        _fgetpos_r, _fsetpos_r, _freopen_r, _rewind_r, freopen64, _freopen64_r,
        _funopen_r, and _fopencookie_r.
        * libc/include/reent.h:  Add function prototype for _stat64_r, align
        _execve_r prototype with POSIX definition for execve.
        * libc/reent/execr.c:  Align function prototype with POSIX definition.
        * libc/stdio/asniprintf.c:  Add #include "local.h".
        * libc/stdio/vasniprintf.c:  Ditto.
        * libc/stdio/fread.c:  Remove unused variable newcount.
        * libc/stdio/local.h:  Add function prototype for __sccl.
        * libc/stdio/open_memstream.c:  Remove unused variable flags.
        * libc/stdio/vfscanf.c:  Proper prototyping for ccfn, remove prototype
        for __sccl since now in local.h.
        * libc/string/memcpy.c:  Add #include <string.h> (for real and for
        traditional synopsis), remove extraneous stddef.h and limits.h.
        * libc/syscalls/sysclose.c:  Add #include <unistd.h>.
        * libc/syscalls/sysfork.c:  Ditto.
        * libc/syscalls/sysgetpid.c:  Ditto.
        * libc/syscalls/sysexecve.c:  Add #include <unistd.h>, align function
        prototype with POSIX definition.
        * libc/syscalls/sysfstat.c:  Add #include <sys/stat.h>.
        * libc/syscalls/sysgettod.c:  Correct sys/times.h to sys/time.h.
        * libc/syscalls/syskill.c:  Add #include <signal.h>.
        * libc/syscalls/syslink.c:  Add #include <unistd.h>, fix prototype.
        * libc/syscalls/sysunlink.c:  Ditto.
        * libc/syscalls/sysstat.c:  Add #include <sys/stat.h>, fix prototype.
        * libc/syscalls/syswait.c:  Add #include <sys/wait.h>, fix prototype.
2008-12-11 17:27:56 +00:00
Jeff Johnston bad5c314f7 2008-11-27 Craig Howland <howland@LGSInnovations.com>
* libc/argz/argz_add.c:  Added #include <argz.h> to get function
        prototypes.
        * libc/argz/argz_append.c: Ditto.
        * libc/argz/argz_count.c: Ditto.
        * libc/argz/argz_create.c: Ditto.
        * libc/argz/argz_create_sep.c: Ditto.
        * libc/argz/argz_delete.c: Ditto.
        * libc/argz/argz_next.c: Ditto.
        * libc/argz/argz_stringify.c: Ditto
        * libc/stdlib/strtod.c: Added #include <stdlib.h> to get function
        prototypes.
        * libc/stdlib/wcstoul.c: Added #include <wchar.h> to get function
        prototypes, corrected traditional usage comment.
        * libc/include/wchar.h: Added _mbsrtowcs_r() prototype.
2008-11-27 20:45:37 +00:00
Jeff Johnston 0aca33c823 2008-11-24 Craig Howland <howland@LGSInnovations.com>
* libc/stdlib/wcstoull_r.c:  Add EINVAL return for bad base value,
        include wchar.h for prototype, remove extraneous includes, use
        C99/POSIX ULLONG_MAX (but allow for poor limits.h).
        * libc/stdlib/wcstoull.c:  Fix usage comments (mistakes and to add
        base value check noted above), remove extraneous includes.
        * libc/stdio/asnprintf.c:  Add #include "local.h" to get function
        prototype for _svfprintf_r().
        * libc/stdio/vasnprintf.c:  Ditto.
        * libc/stdio/local.h:  Add function prototype for __submore().
        * libc/include/stdio.h:  Add function prototypes for _fseeko_r and
        _ftello_r.
        * libc/posix/namespace.h:  Commented out define for write to
        eliminate write() prototype being missing for collate.c (which is
        the only file that presently includes namespace.h).
        * libc/include/reent.h:  Added _rename_r.
        * libc/reent/renamer.c:  Corrected function prototypes in synopses.
        * libc/locale/ldpart.c:  Use struct stat64 when calling fstat64.
2008-11-24 21:27:33 +00:00
Jeff Johnston 8ee939ea9f 2008-11-19 Jeff Johnston <jjohnstn@redhat.com>
* libc/sys/linux/bits/dirent.h: New header file.
        * libc/sys/linux/sys/dirent.h: Include <bits/dirent.h> instead of
        <linux/dirent.h>.
        * libc/posix/Makefile.am: Remove reallocf.
        * libc/posix/Makefile.in: Regenerated.
        * libc/posix/reallocf.c: Moved to...
        * libc/stdlib/reallocf.c: Here
        * libc/stdlib/malloc.c: Add reallocf documentation.
        * libc/include/stdlib.h: Add reallocf and _reallocf_r prototypes.
        * libc/stdlib/Makefile.am: Add reallocf.
        * libc/stdlib/Makefile.in: Regenerated.
        * libc/posix/_isatty.c: Set errno.
2008-11-19 20:56:22 +00:00
Jeff Johnston 1dc1ccd4ae 2008-10-31 Jeff Johnston <jjohnstn@redhat.com>
* libc/stdio/diprintf.c: Modify documentation so eclipse newlib
        libhover docs generate properly.
        * libc/stdio/dprintf.c: Ditto.
        * libc/stdio/fflush.c: Ditto.
        * libc/stdio/fopencookie.c: Ditto.
        * libc/stdio/fread.c: Ditto.
        * libc/stdio/fsetpos.c: Ditto.
        * libc/stdio/getc_u.c: Ditto.
        * libc/stdio/getchar_u.c: Ditto.
        * libc/stdio/putc_u.c: Ditto.
        * libc/stdio/putchar_u.c: Ditto.
        * libc/stdio/remove.c: Ditto.
        * libc/stdio/siprintf.c: Ditto.
        * libc/stdio/siscanf.c: Ditto.
        * libc/stdio/sprintf.c: Ditto.
        * libc/stdio/sscanf.c: Ditto.
        * libc/stdio/vfprintf.c: Ditto.
        * libc/stdio/vfscanf.c: Ditto.
        * libc/stdio/viprintf.c: Ditto.
        * libc/stdio/viscanf.c: Ditto.
        * libc/stdlib/calloc.c: Ditto.
        * libc/stdlib/efgcvt.c: Ditto.
        * libc/stdlib/envlock.c: Ditto.
        * libc/time/asctime.c: Ditto.
        * libc/time/ctime.c: Ditto.
        * libc/time/gmtime.c: Ditto.
        * libc/time/lcltime.c: Ditto.
        * libc/time/tzset.c: Ditto.
        * libc/stdlib/envlock.h: Moved to libc/include.
2008-10-31 21:08:03 +00:00
Jeff Johnston 0d2597f5a0 2008-10-06 Eric Blake <ebb9@byu.net>
* libc/stdlib/ldtoa.c (etoasc): Fix rounding to even when fraction
        is 0.5 or 0.75.
2008-10-06 19:47:06 +00:00
Steve Ellcey fab8d8d808 * configure: Regenerate for new libtool.
* aclocal.m4: Ditto.
	* Makefile.in: Ditto.
	* newlib.hin: Ditto.
	* doc/Makefile.in: Ditto.
	* doc/configure: Ditto.
	* iconvdata/Makefile.in: Ditto.
	* iconvdata/aclocal.m4: Ditto.
	* iconvdata/configure: Ditto.
	* libc/Makefile.in: Ditto.
	* libc/aclocal.m4: Ditto.
	* libc/configure: Ditto.
	* libc/argz/Makefile.in: Ditto.
	* libc/ctype/Makefile.in: Ditto.
	* libc/errno/Makefile.in: Ditto.
	* libc/iconv/Makefile.in: Ditto.
	* libc/iconv/ccs/Makefile.in: Ditto.
	* libc/iconv/ccs/binary/Makefile.in: Ditto.
	* libc/iconv/ces/Makefile.in: Ditto.
	* libc/iconv/lib/Makefile.in: Ditto.
	* libc/locale/Makefile.in: Ditto.
	* libc/machine/Makefile.in: Ditto.
	* libc/machine/aclocal.m4: Ditto.
	* libc/machine/configure: Ditto.
	* libc/machine/a29k/Makefile.in: Ditto.
	* libc/machine/a29k/configure: Ditto.
	* libc/machine/arm/Makefile.in: Ditto.
	* libc/machine/arm/configure: Ditto.
	* libc/machine/bfin/Makefile.in: Ditto.
	* libc/machine/bfin/configure: Ditto.
	* libc/machine/cris/Makefile.in: Ditto.
	* libc/machine/cris/configure: Ditto.
	* libc/machine/crx/Makefile.in: Ditto.
	* libc/machine/crx/configure: Ditto.
	* libc/machine/d10v/Makefile.in: Ditto.
	* libc/machine/d10v/configure: Ditto.
	* libc/machine/d30v/Makefile.in: Ditto.
	* libc/machine/d30v/configure: Ditto.
	* libc/machine/fr30/Makefile.in: Ditto.
	* libc/machine/fr30/configure: Ditto.
	* libc/machine/frv/Makefile.in: Ditto.
	* libc/machine/frv/configure: Ditto.
	* libc/machine/h8300/Makefile.in: Ditto.
	* libc/machine/h8300/configure: Ditto.
	* libc/machine/h8500/Makefile.in: Ditto.
	* libc/machine/h8500/configure: Ditto.
	* libc/machine/hppa/Makefile.in: Ditto.
	* libc/machine/hppa/configure: Ditto.
	* libc/machine/i386/Makefile.in: Ditto.
	* libc/machine/i386/aclocal.m4: Ditto.
	* libc/machine/i386/configure: Ditto.
	* libc/machine/i960/Makefile.in: Ditto.
	* libc/machine/i960/configure: Ditto.
	* libc/machine/iq2000/Makefile.in: Ditto.
	* libc/machine/iq2000/configure: Ditto.
	* libc/machine/m32c/Makefile.in: Ditto.
	* libc/machine/m32c/configure: Ditto.
	* libc/machine/m32r/Makefile.in: Ditto.
	* libc/machine/m32r/configure: Ditto.
	* libc/machine/m68hc11/Makefile.in: Ditto.
	* libc/machine/m68hc11/configure: Ditto.
	* libc/machine/m68k/Makefile.in: Ditto.
	* libc/machine/m68k/configure: Ditto.
	* libc/machine/m88k/Makefile.in: Ditto.
	* libc/machine/m88k/configure: Ditto.
	* libc/machine/mep/Makefile.in: Ditto.
	* libc/machine/mep/configure: Ditto.
	* libc/machine/mips/Makefile.in: Ditto.
	* libc/machine/mips/configure: Ditto.
	* libc/machine/mn10200/Makefile.in: Ditto.
	* libc/machine/mn10200/configure: Ditto.
	* libc/machine/mn10300/Makefile.in: Ditto.
	* libc/machine/mn10300/configure: Ditto.
	* libc/machine/mt/Makefile.in: Ditto.
	* libc/machine/mt/configure: Ditto.
	* libc/machine/necv70/Makefile.in: Ditto.
	* libc/machine/necv70/configure: Ditto.
	* libc/machine/powerpc/Makefile.in: Ditto.
	* libc/machine/powerpc/configure: Ditto.
	* libc/machine/sh/Makefile.in: Ditto.
	* libc/machine/sh/configure: Ditto.
	* libc/machine/sparc/Makefile.in: Ditto.
	* libc/machine/sparc/configure: Ditto.
	* libc/machine/spu/Makefile.in: Ditto.
	* libc/machine/spu/configure: Ditto.
	* libc/machine/tic4x/Makefile.in: Ditto.
	* libc/machine/tic4x/configure: Ditto.
	* libc/machine/tic80/Makefile.in: Ditto.
	* libc/machine/tic80/configure: Ditto.
	* libc/machine/v850/Makefile.in: Ditto.
	* libc/machine/v850/configure: Ditto.
	* libc/machine/w65/Makefile.in: Ditto.
	* libc/machine/w65/configure: Ditto.
	* libc/machine/x86_64/Makefile.in: Ditto.
	* libc/machine/x86_64/configure: Ditto.
	* libc/machine/xscale/Makefile.in: Ditto.
	* libc/machine/xscale/configure: Ditto.
	* libc/machine/xstormy16/Makefile.in: Ditto.
	* libc/machine/xstormy16/configure: Ditto.
	* libc/machine/z8k/Makefile.in: Ditto.
	* libc/machine/z8k/configure: Ditto.
	* libc/misc/Makefile.in: Ditto.
	* libc/posix/Makefile.in: Ditto.
	* libc/reent/Makefile.in: Ditto.
	* libc/search/Makefile.in: Ditto.
	* libc/signal/Makefile.in: Ditto.
	* libc/stdio/Makefile.in: Ditto.
	* libc/stdio64/Makefile.in: Ditto.
	* libc/stdlib/Makefile.in: Ditto.
	* libc/string/Makefile.in: Ditto.
	* libc/sys/Makefile.in: Ditto.
	* libc/sys/aclocal.m4: Ditto.
	* libc/sys/configure: Ditto.
	* libc/sys/a29khif/Makefile.in: Ditto.
	* libc/sys/a29khif/configure: Ditto.
	* libc/sys/arc/Makefile.in: Ditto.
	* libc/sys/arc/configure: Ditto.
	* libc/sys/arm/Makefile.in: Ditto.
	* libc/sys/arm/configure: Ditto.
	* libc/sys/d10v/Makefile.in: Ditto.
	* libc/sys/d10v/configure: Ditto.
	* libc/sys/decstation/Makefile.in: Ditto.
	* libc/sys/decstation/configure: Ditto.
	* libc/sys/h8300hms/Makefile.in: Ditto.
	* libc/sys/h8300hms/configure: Ditto.
	* libc/sys/h8500hms/Makefile.in: Ditto.
	* libc/sys/h8500hms/configure: Ditto.
	* libc/sys/linux/Makefile.in: Ditto.
	* libc/sys/linux/aclocal.m4: Ditto.
	* libc/sys/linux/configure: Ditto.
	* libc/sys/linux/argp/Makefile.in: Ditto.
	* libc/sys/linux/cmath/Makefile.in: Ditto.
	* libc/sys/linux/dl/Makefile.in: Ditto.
	* libc/sys/linux/iconv/Makefile.in: Ditto.
	* libc/sys/linux/intl/Makefile.in: Ditto.
	* libc/sys/linux/linuxthreads/Makefile.in: Ditto.
	* libc/sys/linux/linuxthreads/aclocal.m4: Ditto.
	* libc/sys/linux/linuxthreads/configure: Ditto.
	* libc/sys/linux/linuxthreads/machine/Makefile.in: Ditto.
	* libc/sys/linux/linuxthreads/machine/aclocal.m4: Ditto.
	* libc/sys/linux/linuxthreads/machine/configure: Ditto.
	* libc/sys/linux/linuxthreads/machine/i386/Makefile.in: Ditto.
	* libc/sys/linux/linuxthreads/machine/i386/aclocal.m4: Ditto.
	* libc/sys/linux/linuxthreads/machine/i386/configure: Ditto.
	* libc/sys/linux/machine/Makefile.in: Ditto.
	* libc/sys/linux/machine/aclocal.m4: Ditto.
	* libc/sys/linux/machine/configure: Ditto.
	* libc/sys/linux/machine/i386/Makefile.in: Ditto.
	* libc/sys/linux/machine/i386/aclocal.m4: Ditto.
	* libc/sys/linux/machine/i386/configure: Ditto.
	* libc/sys/linux/net/Makefile.in: Ditto.
	* libc/sys/linux/stdlib/Makefile.in: Ditto.
	* libc/sys/m88kbug/Makefile.in: Ditto.
	* libc/sys/m88kbug/configure: Ditto.
	* libc/sys/mmixware/Makefile.in: Ditto.
	* libc/sys/mmixware/configure: Ditto.
	* libc/sys/netware/Makefile.in: Ditto.
	* libc/sys/netware/configure: Ditto.
	* libc/sys/rdos/Makefile.in: Ditto.
	* libc/sys/rdos/configure: Ditto.
	* libc/sys/rtems/Makefile.in: Ditto.
	* libc/sys/rtems/configure: Ditto.
	* libc/sys/sh/Makefile.in: Ditto.
	* libc/sys/sh/configure: Ditto.
	* libc/sys/sparc64/Makefile.in: Ditto.
	* libc/sys/sparc64/configure: Ditto.
	* libc/sys/sun4/Makefile.in: Ditto.
	* libc/sys/sun4/configure: Ditto.
	* libc/sys/sysmec/Makefile.in: Ditto.
	* libc/sys/sysmec/configure: Ditto.
	* libc/sys/sysnec810/Makefile.in: Ditto.
	* libc/sys/sysnec810/configure: Ditto.
	* libc/sys/sysnecv850/Makefile.in: Ditto.
	* libc/sys/sysnecv850/configure: Ditto.
	* libc/sys/sysvi386/Makefile.in: Ditto.
	* libc/sys/sysvi386/configure: Ditto.
	* libc/sys/sysvnecv70/Makefile.in: Ditto.
	* libc/sys/sysvnecv70/configure: Ditto.
	* libc/sys/tic80/Makefile.in: Ditto.
	* libc/sys/tic80/configure: Ditto.
	* libc/sys/w65/Makefile.in: Ditto.
	* libc/sys/w65/configure: Ditto.
	* libc/sys/z8ksim/Makefile.in: Ditto.
	* libc/sys/z8ksim/configure: Ditto.
	* libc/syscalls/Makefile.in: Ditto.
	* libc/time/Makefile.in: Ditto.
	* libc/unix/Makefile.in: Ditto.
	* libm/Makefile.in: Ditto.
	* libm/aclocal.m4: Ditto.
	* libm/configure: Ditto.
	* libm/common/Makefile.in: Ditto.
	* libm/machine/Makefile.in: Ditto.
	* libm/machine/aclocal.m4: Ditto.
	* libm/machine/configure: Ditto.
	* libm/machine/i386/Makefile.in: Ditto.
	* libm/machine/i386/aclocal.m4: Ditto.
	* libm/machine/i386/configure: Ditto.
	* libm/machine/spu/Makefile.in: Ditto.
	* libm/machine/spu/configure: Ditto.
	* libm/math/Makefile.in: Ditto.
	* libm/mathfp/Makefile.in: Ditto.
2008-09-29 15:40:48 +00:00
Jeff Johnston 9e71090b9a 2008-09-26 Craig Howland <howland@LGSInnovations.com>
* libc/stdlib/getenv_r.c (_getenv_r): Modify to not match if name
        contains an equal sign.
2008-09-26 16:23:58 +00:00
Jeff Johnston 57d7cfcdb7 2008-09-24 Jeff Johnston <jjohnstn@redhat.com>
* libc/stdlib/setenv_r.c (_unsetenv_r): Modify to return -1 only if
        name is NULL, empty, or contains equal sign.
2008-09-25 03:00:04 +00:00
Jeff Johnston 37f996a2b2 2008-09-24 Pawel Veselov <pawel.veselov@gmail.com>
Fix setenv/getenv/unsetenv to be OpenGroup compliant:
        * libc/include/stdlib.h (unsetenv, _unsetenv_r): Redefine with integer
        return types.
        * libc/stdlib/getenv_r.c (_findenv_r): Do no special processing with
        names that contain equal chars.
        * libc/stdlib/setenv.c: Redefine _unsetenv_r as returning int.
        * libc/stdlib/setenv_r.c (_setenv_r): Return -1 and set errno to
        EINVAL if name contains an equal sign.  Do not remove any equal signs
        from the value.
        (_unsetenv_r): Modified to return int.  Return -1 and set EINVAL
        if name contains equal sign.  Return -1 if no variable(s) were found
        and return 0 otherwise.
2008-09-25 01:23:08 +00:00
Jeff Johnston 60ac13a0b0 2008-08-28 Corinna Vinschen <corinna@vinschen.de>
* libc/stdlib/wcsrtombs.c (_wcsrtombs_r): Optimize condition
        for accepting a converted character.
2008-08-28 17:36:49 +00:00
Jeff Johnston 2d8d8175f1 2008-08-27 Corinna Vinschen <corinna@vinschen.de>
* libc/stdlib/wcsrtombs.c (_wcsrtombs_r): Fix condition for
        accepting a converted character and continuing the loop.
2008-08-27 18:31:04 +00:00
Hans-Peter Nilsson 5592f939b4 Fix strict-aliasing issues with _strtod_r and Storeinc.
* libc/stdlib/strtod.c (_strtod_r): Change local variables aadj,
	rv, rv0 from double to type U.  Use accessor macros dval, dword0
	and dword1 for all accesses except for the ULtod call, where rv.i
	replaces the pointer cast.
	* libc/stdlib/mprec.h (U): Rename member L to i for easier re-use
	of access macros.  Tweak comment.
	Remove #ifdef'd YES_ALIAS code.
	(dword0, dword1, dval): Define in terms of uncast union member
	access.  Ditto for _DOUBLE_IS_32BITS variants.
	(Storeinc): Replace aliasing-flawed microoptimized definition with
	alternative suggested in comment.  Remove now stale comment.
2008-06-25 01:45:02 +00:00
Jeff Johnston c622842865 2008-03-07 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/getopt.h: Hide newlib extensions under
        the __need_getopt_newlib flag.
        * libc/stdlib/getopt.c: #define __need_getopt_newlib before including
        getopt.h.  Put entire code under !HAVE_GETOPT to support platforms
        with their own getopt implementation.
        * configure.host: Specify HAVE_GETOPT for x86-linux.
2008-03-07 18:16:35 +00:00
Eric Blake beb0ab6466 Fix strtod("nan()", ptr).
* libc/stdlib/gdtoa-hexnan.c (hexnan): When the optional
n-char-sequence is omitted, still parse the ().
-------------------------------------------------------------------
2008-03-04 18:27:01 +00:00
Jeff Johnston 76ff710cfa 2008-02-29 Gregory Pietsch <gpietsch@comcast.net>
* libc/stdlib/getopt.c (getopt_internal): Rewrite to accept
        data area so as to support reentrant calls.  Change all callers
        to fill in data area with global values and restore any changes
        to the global values after call.
        (__getopt_r, __getopt_long_r, __getopt_long_only_r): New routines
        to support reentrancy that add a data area argument.
        * libc/include/getopt.h: Add new _r routines and provide macros
        so they can be called with using double-underscores.
2008-02-29 21:11:57 +00:00
Eric Blake 7a44c13ecb Fix strtod("-0x", NULL).
* libc/stdlib/strtod.c (_strtod_r): Fall back to 0 if hex parse
fails.
2008-02-21 17:14:14 +00:00
Jeff Johnston f46f40b54e 2008-02-12 Peter Rosin <peda@lysator.liu.se>
* libc/stdlib/getopt.c (getopt_internal): Handle optional
        arguments better for long options and short options not
        appearing as the first option in a sequence.
2008-02-12 17:20:09 +00:00
Jeff Johnston 26b8429317 2007-12-19 Jeff Johnston <jjohnstn@redhat.com>
* NEWS: Update with 1.16.0 info.
        * README: Ditto.
        * acinclude.m4: Change version number to 1.16.0.
        * aclocal.m4: Regenerated.
        * configure: Ditto.
        * doc/aclocal.m4: Ditto.
        * doc/configure: Ditto.
        * libc/*/aclocal.m4: Ditto.
        * libc/*/configure: Ditto.
        * libc/libc.texinfo: Ditto.
        * libm/*/aclocal.m4: Ditto.
        * libm/*/configure: Ditto.
        * libm/libm.texinfo: Ditto.
        * libc/sys/linux/shared.ld: Add VERS_1.16.
2007-12-19 22:36:48 +00:00
Jeff Johnston 2a3a02a687 2007-10-23 Jeff Johnston <jjohnstn@redhat.com>
* libc/stdlib/wcstombs_r.c: Add SUSV2 support for calculating
        size if output buffer is NULL.
2007-10-23 19:50:29 +00:00
Jeff Johnston 6ddf8bef40 2007-08-31 Antony King <antony.king@st.com>
* libc/stdlib/mprec.h [_DOUBLE_IS_32BITS}: Define IEEE_Arith
        bits and redefine associated dword0 macro (rvalue issue).
        * libc/stdio/vfieeefp.h: Ditto.
        * libc/stdlib/strtod.c: Add checks for _DOUBLE_IS_32BITS
        to prevent setting dword1 which is an rvalue only.
2007-08-31 21:21:27 +00:00
Corinna Vinschen dec27025b2 * libc/include/wchar.h: Declare wcstol, wcstoll, wcstoul,
wcstoull, _wcstol_r, _wcstoll_r, _wcstoul_r and _wcstoull_r.
	* libc/stdlib/Makefile.am (GENERAL_SOURCES): Add wcstol.c and wcstoul.c.
	(EXTENDED_SOURCES): Add wcstoll.c, wcstoll_r.c, wcstoull.c and
	wcstoull_r.c.
	(CHEWOUT_FILES): Add .def files accordingly.
	* libc/stdlib/Makefile.in: Regenerate.
	* libc/stdlib/stdlib.tex: Add documentation links for above functions.
	* libc/stdlib/strtoll.c: Fix portability note.
	* libc/stdlib/strtoull.c: Ditto.
	* libc/stdlib/wcstol.c: New file.
	* libc/stdlib/wcstoll.c: New file.
	* libc/stdlib/wcstoll_r.c: New file.
	* libc/stdlib/wcstoul.c: New file.
	* libc/stdlib/wcstoull.c: New file.
	* libc/stdlib/wcstoull_r.c: New file.
2007-07-06 20:03:28 +00:00
Eric Blake 3473e6bd7b Support __func__ in assert, as required by C99.
* libc/stdlib/assert.c (__assert_func): New function.
	(__assert): Use __assert_func.
	* libc/include/assert.h (assert) [!NDEBUG]: Use __assert_func when
	possible.
2007-06-27 12:44:41 +00:00
Jeff Johnston 1eeaeab855 2007-06-06 Christian Groessler <chris@groessler.org>
* libc/stdlib/ldtoa (_ldcheck): Make sure the setting of
        rnd is done after the last local variable declaration.

2007-06-06  Jeff Johnston  <jjohnstn@redhat.com>

        * libc/stdlib/mprec.h[Just_16]: Make sure that Pack_16 is defined.
2007-06-06 19:24:28 +00:00
Eric Blake b206478328 Avoid more compiler warnings.
* libc/stdlib/btowc.c: Add missing header.
* libc/stdlib/getopt.c (getopt_internal): Initialize variable.
* libc/stdlib/system.c (do_system) [__CYGWIN__]: Add declaration.
* libc/stdlib/wctob.c: Add missing header.
* libc/string/strcpy.c (strcpy): Avoid warnings.
* libc/string/strrchr.c (strrchr): Likewise.
2007-05-29 21:26:59 +00:00
Steve Ellcey d9a1ecc006 * ltmain.sh: Update from GCC.
* libtool.m4: Update from GCC.
	* ltsugar.m4: New. Update from GCC.
	* ltversion.m4: New. Update from GCC.
	* ltoptions.m4: New. Update from GCC.
	* ltconfig: Remove.
	* ltcf-c.sh: Remove.
	* ltcf-cxx.sh: Remove.
	* ltcf-gcj.sh: Remove.
	* src-release: Update with new libtool file list.
	* newlib/*/configure.in: invoke _LD_DECL_SED.
	* newlib/*/Makefile.am: Ensure toplevel is included in ACLOCAL_AMFLAGS.
	* Regenerate subdirectories
2007-05-24 17:33:42 +00:00
Eric Blake 895d76fed6 * libc/include/math.h (INFINITY, NAN, FP_ILOGB0, FP_ILOGBNAN)
(MATH_ERRNO, MATH_ERREXCEPT, math_errhandling): Add macros
	required by POSIX.
	* libc/stdlib/ldtoa.c (USE_INFINITY): Rename from INFINITY, to
	avoid clash with <math.h>.
2007-05-16 19:59:40 +00:00
Eric Blake f65607751c * libc/stdlib/wctomb_r.c (_wctomb_r): Avoid gcc warnings on cygwin.
* libc/search/hash.c (__hash_open): Likewise.
2007-05-16 19:31:08 +00:00
Jeff Johnston 714d0b7a88 2007-04-23 Ralf Wildenhues <Ralf.Wildenhues <at> gmx.de>
* confsubdir.m4 (AC_CONFIG_SUBDIRS, _AC_OUTPUT_SUBDIRS): New
        file.  Override Autoconf-2.59's version of these macros with
        fixed handling of multiple adjacent whitespace in arguments.
        * aclocal.m4: Regenerated forcefully.
        * configure: Ditto.
        * Makefile.in: Ditto.
        * libc/*Makefile.in: Ditto.
        * libc/*aclocal.m4: Ditto.
        * libc/*configure: Ditto.
        * libm/*Makefile.in: Ditto.
        * libm/*aclocal.m4: Ditto.
        * libm/*configure: Ditto.
2007-04-23 22:52:37 +00:00
Kazu Hirata 0efa93c061 * libc/stdlib/__call_atexit.c (__call_exitprocs): Handle atexit
functions registering additional atexit functions.
2007-04-05 16:47:38 +00:00
Jeff Johnston 0733ae3bca 2007-01-31 Kazunori Asayama <asayama@sm.sony.co.jp>
* configure.host: Define stdio directory as a variable.
	* libc/Makefile.am: Define stdio related names
	as macros.
	* libc/configure.in: Add detection routine of stdio directory.
	* libc/Makefile.in: Regenerated.
	* libc/configure: Ditto.
	* libc/argz/Makefile.in: Ditto.
	* libc/ctype/Makefile.in: Ditto.
	* libc/errno/Makefile.in: Ditto.
	* libc/iconv/Makefile.in: Ditto.
	* libc/iconv/ccs/Makefile.in: Ditto.
	* libc/iconv/ccs/binary/Makefile.in: Ditto.
	* libc/iconv/ces/Makefile.in: Ditto.
	* libc/iconv/lib/Makefile.in: Ditto.
	* libc/locale/Makefile.in: Ditto.
	* libc/misc/Makefile.in: Ditto.
	* libc/posix/Makefile.in: Ditto.
	* libc/reent/Makefile.in: Ditto.
	* libc/search/Makefile.in: Ditto.
	* libc/signal/Makefile.in: Ditto.
	* libc/stdio/Makefile.in: Ditto.
	* libc/stdio64/Makefile.in: Ditto.
	* libc/stdlib/Makefile.in: Ditto.
	* libc/string/Makefile.in: Ditto.
	* libc/syscalls/Makefile.in: Ditto.
	* libc/time/Makefile.in: Ditto.
	* libc/unix/Makefile.in: Ditto.
2007-01-31 19:34:38 +00:00
Jeff Johnston 78b7c6f817 2006-12-18 Jeff Johnston <jjohnstn@redhat.com>
* aclocal.m4 */aclocal.m4: Regenerated using aclocal 1.9.6.
        * Makefile.in */Makefile.in: Regenerated using automake 1.9.6.
2006-12-18 20:32:52 +00:00
Jeff Johnston f522256075 2006-12-18 Jeff Johnston <jjohnstn@redhat.com>
* libc/stdlib/mallocr.c (malloc_extend_top): Add patch from
        2.6.5 version of Doug Lea's malloc which is the basis of
        this code.
2006-12-18 20:21:48 +00:00
Jeff Johnston 8f9f25dad8 2006-09-12 Paul Brook <paul@codesourcery.com>
* libc/stdlib/rand.c (srand): Add _REENT_CHECK_RAND48.
2006-09-12 17:31:40 +00:00