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.
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.
* libc/include/math.h: Simplify fpclassify, isinf, isnan, and signbit
macros to remove un-necessary extension use. isinf and isnan also
changed to use fpclassify. isfinite macro modified to run faster by
only calling fpclassify once instead of possibly twice.
* libc/locale/locale.c (lc_ctype_cjk_lang): New static int.
(loadlocale): In case of setting LC_CTYPE, set lc_ctype_cjk_lang
to 1 if the language is "jp", "ko", or "zh", to 0 otherwise.
(__locale_cjk_lang): New function.
* libc/string/local.h (__locale_cjk_lang): Declare.
* libc/string/wcwidth.c: Fix comments.
(__wcwidth): Handle CJK Ambiguous Width characters according
to setting returned by __locale_cjk_lang.
(__jp2uc): Change the scope to static function.
* libc/ctype/local.h (_jp2uc): Define as macro if defined __CYGWIN__.
* libc/string/local.h (_jp2uc): Include ../ctype/local.h.
* configure.in: Add configuration test for long double type existing
and set flag _HAVE_LONG_DOUBLE if true. Fix INIT_ARRAY (.init_array)
and _LDBL_EQ_DBL tests to not link so that will work with
cross-compilers.
* configure: Regenerated.
* Makefile.in: Ditto.
* newlib.hin: Add _HAVE_LONG_DOUBLE flag.
* libc/include/math.h: Change non-builtin defines for HUGE_VAL,
HUGE_VALF, and HUGE_VALL to be constant expressions. Add definitions
for the non-builtin case for INFINITY and NAN. Gate HUGE_VALL and
union __ldmath definitions with (new) _HAVE_LONG_DOUBLE.
*libm/common/s_infconst.c: Change definitions to use values from
float.h instead of non-so-portable integer forms. Mark as being
deprecated (because now removed from math.h, are not used anywhere
in Newlib, itself).
* libc/string/wcswidth.c (wcswidth): Convert japanese wide
characters to Unicode here. Handle surrogate pairs for UTF-16
systems. Call __wcwidth rather than wcwidth.
* libc/string/wcwidth.c: New implementation using Markus Kuhn's
wcwidth implementation for Unicode.
(bisearch): New static function.
(__wcwidth): New function. Take wint_t rather than wchar_t as
parameter to allow full Unicode handling on UTF-16 systems.
Move old wcwidth implementation here for non-multibyte aware
systems.
(wcwidth): Convert japanese wide characters to Unicode here.
Call __wcwidth rather than using iswprint/iswcntrl.
* libc/include/ctype.h (toupper, tolower)
[_MB_EXTENDED_CHARSETS_ISO]: Allow gcc warning when called with
'char' even when we must call the function for correct behavior.
[!_MB_EXTENDED_CHARSETS_ISO]: Fix regression in result type.
* libc/stdio/fgetc.c: Make sure sfp lock is acquired before the
file lock and released before the file lock to avoid a deadlock
scenario.
* libc/stdio/fgets.c: Ditto.
* libc/stdio/fgetwc.c: Ditto.
* libc/stdio/fgetws.c: Ditto.
* libc/stdio/fread.c: Ditto.
* libc/stdio/fseek.c: Ditto.
* libc/stdio/getc.c: Ditto.
* libc/stdio/getdelim.c: Ditto.
* libc/stdio/gets.c: Ditto.
* 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.
* libc/include/ctype.h (isalpha, isupper, islower, isdigit)
(isxdigit, isspace, ispunct, isalnum, isprint, isgraph)
(iscntrl, isblank, toupper, tolower): Rewrite to let 'gcc -Wall'
warn when user calls macro with a char argument.
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.
_CTYPE_DATA_128_256.
* libc/ctype/ctype_cp.h: Split off all character class values for
character 255 from the rest of the definitions.
(__ctype_cp): Use the new definitions. Make sure that the table
always contains 0 for EOF (-1).
* libc/ctype/ctype_iso.h: Ditto.
* libc/include/math.h: Change _LDBL_EQ_DBL flag usage to
be _HAVE_LDBL_MATH.
* libc/include/stdlib.h: Change _LDBL_EQ_DBL flag usage to
be _HAVE_LDBL_STDLIB.
* libc/ctype/ctype_cp.h: Mark non-cased letters in tables for codepages
720, 862, 874, 1255, and 1256 to _U|_L. Fix a couple of incorrect
class mappings.
* libc/ctype/ctype_iso.h: Mark non-cased letters in ISO-8859 tables
6, 8, and 11 to _U|_L. Fix a couple of incorrect class mappings.
* libc/ctype/isblank.c (isblank): Special case TAB.
* libc/ctype/islower.c (islower): Check explicitely for _L flag only
in (_U|_L).
* libc/ctype/isupper.c (isupper): Ditto, but check for _U flag.
* libc/include/ctype.h (islower): Same in macro.
(isupper): Ditto.
(isblank): Special case TAB. Redefine macro for GCC only.
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.
ctype_cp.h out of ALLOW_NEGATIVE_CTYPE_INDEX case.
(__ctype_ptr__): Constify in !_MB_CAPABLE case. Otherwise,
de-constify in !ALLOW_NEGATIVE_CTYPE_INDEX case, too. Add comment.
(__set_ctype): Set __ctype_ptr__ pointer according to definition
of ALLOW_NEGATIVE_CTYPE_INDEX.
* libc/include/ctype.h (__ctype_ptr__): Constify in !_MB_CAPABLE case.
source files. Add a dependency rule for ctype_o to note
changes in ctype_iso.h and ctype_cp.h.
* libc/ctype/Makefile.in: Regenerate.
* libc/ctype/_tolower.c: Remove file.
* libc/ctype/_toupper.c: Remove file.
* libc/ctype/ctype_.c: Make sure ALLOW_NEGATIVE_CTYPE_INDEX
is always defined on Cygwin.
(_ctype_b): Don't make `static const' on Cygwin.
(ctype_iso.h): Include if _MB_EXTENDED_CHARSETS_ISO is set.
(ctype_cp.h): Include if _MB_EXTENDED_CHARSETS_WINDOWS is set.
(__ctype_ptr): Drop definition.
(__ctype_ptr__): De-constify. Mark as __EXPORT symbol.
(_ctype_): Add Cygwin-specifc asm define.
(__set_ctype): New function to set __ctype_ptr__ according to
current charset.
* libc/ctype/ctype_cp.h: New file containing Windows codepage
specific character class tables.
* libc/ctype/ctype_iso.h: New file containing ISO-8859-x
specific character class tables.
* libc/ctype/tolower.c (tolower): Reimplement to support any singlebyte
charset if one of the extended charsets is enabled.
* libc/ctype/toupper.c (toupper): Ditto.
* libc/include/ctype.h (_tolower): Define as macro per POSIX.
(_toupper): Ditto.
(__ctype_ptr__): De-constify.
(toupper): Disable macro on systems supporting extended charsets.
(tolower): Ditto.
* libc/include/sys/config.h (__EXPORT): Define empty if not defined.
* libc/locale/locale.c (__mb_cur_max): Mark as __EXPORT symbol.
(__set_ctype): Declare unconditionally.
(loadlocale): Remove __CYGWIN__ guard around __set_ctype call.
* libc/include/math.h: (llround, llroundf): Declare.
* libm/common/s_llround.c: New file, implementing llround().
* libm/common/sf_llround.c: New file, implementing llroundf().
* libm/common/sf_lround.c: Remove spurious cast in _DOUBLE_IS_32BITS
version of function.
* libm/common/sf_lrint.c: Ditto.
* libm/common/sf_logb.c: Corrected return for subnormal argument
by replacing existing function with a version created from sf_ilogb.c.
* libm/common/s_logb.c: Ditto, except starting point s_ilogb.c. Also
added documentation for logb() and logbf().
* libm/common/s_signbit.c: Add signbit() documentation.
* libm/common/s_log2.c: Update return values to match what w_log2.c has,
since log2 uses log(); add note about being derived instead of direct.
* libm/common/sf_fma.c: Add casts to attempt to get correct results,
as well as comments pointing out problems with the implementation.
* libm/common/s_fma.c: Add fma() and fmaf() documentation.
* libm/common/sf_remquo.c: Incorrect quotient returns for large values
corrected by discarding existing function and replacing with Sun
verion, with some enhancements.
* libm/common/s_remquo.c: Ditto. Add remquo() and remquof()
documentation.
* libm/common/s_fmax.c: Add fmax() and fmaxf() documentation.
* libm/common/s_fmin.c: Add fmin() and fminf() documentation.
* libm/common/s_fdim.c: Return NAN for NAN arg, add fdim() and fdimf()
documentation.
* libm/common/sf_fdim.c: Return NAN for NAN arg, HUGE_VALF for inf arg.
* libm/common/s_trunc.c: Add trunc() and truncf() documentation.
* libm/common/s_rint.c: Add rint() and rintf() documentation.
* libm/common/s_round.c: Add round() and roundf() documentation.
* libm/common/s_scalbn.c: Add scalbln() and scalblnf() documentation.
* libm/common/s_infinity.c: Add infinity() and infinityf()
documentation.
* libm/common/s_lround.c: Add lround(), lroundf(), llround(), and
llroundf() documentation.
* libm/common/s_lrint.c: Add lrint(), lrintf(), llrint(), and llrintf()
documentation.
* libm/common/isgreater.c: New file for documenting math.h function-like
macros isgreater(), isgreaterequal(), isless(), islessequal(),
islessgreater(), and isunordered().
* libm/common/s_isnan.c: Add documentation for function-like macros
fpclassify(), isfinite(), isinf(), isnan(), and isnormal().
* libm/common/s_nearbyint.c: Add nearbyint() and nearbyintf()
documentation.
* libm/common/Makefile.am: Add s_llround.c (src); sf_llround.c (fsrc);
s_fdim.def, s_fma.def, s_fmax.def, s_fmin.def,
s_logb.def, s_lrint.def, s_lround.def, s_nearbyint.def, s_remquo.def,
s_rint.def, s_round.def, s_signbit.def, s_trunc.def, and
isgreater.def (chobj);
re-name all existing chew files (chobj) to match source file base
names (put in underscores), delete all special targets for chew files
(leaving all to be generated by rule).
* libm/common/Makefile.in: regenerate.
* libm/math/w_exp2.c: Add "base 2" to documentation description (and
delete TRAD_SYNOPSIS).
* libm/math/w_gamma.c: Add tgamma() and tgammaf() documentation, along
with some history behind the function names.
* libm/math/math.tex: Add includes for newly-added documentation (see
.def additions to common/Makefile.am and math/Makefile.am in this
ChangeLog list), adjusted existing .def file names to match source file
base names (added underscores); add mention of HUGE_VALF; rename
"Version of library" section to "Error Handling" and add some text
about floating-point exception; added section "Standards Compliance And
Portability".
* libm/math/Makefile.am: Add w_exp2.def (chobj);
re-name all existing chew files (chobj) to match source file base
names, delete all special targets for chew files (leaving all to be
generated by rule).
* libm/math/Makefile.in: regenerated
* doc/makedoc.c: Change silent ignoring of commands < 5 characters
to a failure when reading macro file for commands < 4 characters;
add -v (verbose) option for printing some debugging information;
get rid of spurious translation of "@*" to "*" (no source files used @*,
so no existing doc pages were affected); clean up some compiler
warnings.
* doc/doc.str: add BUGS and SEEALSO sections (to match texi2pod.pl
which has them); Remove ITEM command (redundant with makedoc built-in
"o", not used in any present source file so nothing is lost, anyway).
* HOWTO: New file to hold information for maintainers regarding how
to do things. Initial sections on documentation and ELIX levels.
_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.
* libc/include/sys/errno.h: Protect various non-standard errnos
with either __LINUX_ERRNO_EXTENSIONS__ or __CYGWIN__.
* libc/include/sys/config.h[__CYGWIN__]: Define
__LINUX_ERRNO_EXTENSIONS__.
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.
correct how terminating L'\0' is added;
change return to match standard for when output does not fit;
some corrections and enhancements to the docs.
* libc/stdio/vswprintf.c (_vswprintf_r): ditto, except for docs.
* libc/stdio/vfwprintf.c: some corrections to the docs and some
enhancements to comments. (No code changes.)
* libc/time/strftime.c: Correct some problems that made wcsftime()
not work correctly: work properly with swprintf returns that are
different from snprintf returns, correct test vector lengths for
when sizeof(wchar_t) > 1.
* libc/stdio/sprintf.c: Some documentation and comment corrections and
enhancements to match those done to swprintf.c.
defines strftime(), but can also define wcsftime(); add optional
test package; speed up %Y handling.
* libc/time/wcsftime.c: New file, defining wcsftime() (albeit
indirectly by including strftime.c) and its documentation.
* libc/time/time.tex: Enhance tm_isdst explanation, change strftime
description to match modified description in strftime.c
* libc/time/Makefile.am: Add wcsftime.c and wcsftime.def. Add a rule
so that wcsftime.o gets rebuilt when strftime changes.
* libc/time/Makefile.in: Regenerate.
* libc/include/wchar.h (wcsftime): Declare.
statements in _REENT_SMALL case. Check if _atexit is not NULL before
dereferencing it.
(_wrapup_reent): Check if _atexit is not NULL before dereferencing it.
* libc/include/wchar.h: Include stdarg.h.
(__VALIST): Define conditionally.
(fwprintf, swprintf, vfwprintf, vswprintf, vwprintf, wprintf: Declare.
(_fwprintf_r, _swprintf_r, _vfwprintf_r, _vswprintf_r, _vwprintf_r,
_wprintf_r): Declare.
* libc/stdio/Makefile.am: Add new files.
* libc/stdio/Makefile.in: Regenerate.
* libc/stdio/fwprintf.c: New file.
* libc/stdio/local.h (_svfwprintf_r, _svfiwprintf_r): Declare.
(__CH_CLASS, __STATE, __ACTION): Move definition from vfprintf.c here
and move to the __ namespace.
(__chclass, __state_table, __action_table): Declare.
* libc/stdio/stdio.tex: Add new documentation references.
* libc/stdio/swprintf.c: New file.
* libc/stdio/vfprintf.c (__SPRINT): New macro to call the right
__sprint_r function according to compilation unit. Use throughout.
(__ssprint_r): Rename STRING_ONLY variant from __sprint_r.
Make externaly available. Only define if INTEGER_ONLY is defined.
(__sprint_r): Make externaly available. Only define if INTEGER_ONLY
is defined. Handle stream orientation.
(__sbprintf): Copy FILE's _flags2 member as well.
(__chclass, __state_table, __action_table): Prepend __ to name and
make externally available.
* libc/stdio/vfwprintf.c: New file.
* libc/stdio/vswprintf.c: New file.
* libc/stdio/vwprintf.c: New file.
* libc/stdio/wprintf.c: New file.
* 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.
* 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.
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.
* libc/unix/ttyname.c: Remove ttyname_r() (to a new file to avoid
coupling ttyname_r() and ttyname() due to the latter's large buffer).
* libc/unix/ttyname_r.c: New file to hold ttyname_r(), previously in
ttyname.c.
* libc/unix/ttyname.h: New file (common size definition for the 2
ttyname*c files that are now split).
* libc/unix/Makefile.am (ELIX_2_SOURCES): Add ttyname_r.c.
* libc/unix/Makefile.in: Regenerate.
* 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>.
(struct memstream): Add wide element.
Change saved to a union to take char and wchar_t values.
(memwriter): Accommodate wide-oriented oeprations.
(memseeker): Ditto.
(memseeker64): Ditto.
(memcloser): Ditto.
(internal_open_memstream_r): New static function. Take functionality
from former _open_memstream_r and handle additional "wide" parameter.
(_open_memstream_r): Just call internal_open_memstream_r with wide==-1
from here.
(_open_wmemstream_r): New function.
(open_wmemstream): Ditto.
* libc/include/wchar.h (open_wmemstream): Declare.
(_open_wmemstream_r): Declare.
* libc/machine/arm/arm_asm.h: New file.
* libc/machine/arm/strlen.c: New file.
* libc/machine/arm/strcpy.c: New file.
* libc/machine/arm/strcmp.c: New file.
* libc/machine/arm/Makefile.am: Add new string routines.
* libc/include/stdint.h (INT64_C, UINT64_C, INTMAX_C, UINTMAX_C)
[__have_long64 && __have_longlong64]: Use L and UL, not LL and ULL.
* libc/include/inttypes.h (__PRI64, __SCN64, __PRIMAX, __SCNMAX,
__PRIPTR, __SCNPTR) [__have_long64 && __have_longlong64]: Use l,
not ll.
* libc/include/sys/features.h: Set RTEMS's _POSIX_MONOTONIC_CLOCK to
200112L (SUSv3 compliance).
Comment out RTEMS's _POSIX_SHARED_MEMORY_OBJECTS (Unsupported).
* libc/include/stdint.h (INT32_MIN, INT32_MAX, UINT32_MAX,
INT_LEAST32_MIN, INT_LEAST32_MAX, UINT_LEAST32_MAX): Define to
constants with "long" types where appropriate.
(INT_FAST8_MIN, INT_FAST8_MAX, UINT_FAST8_MAX, INT_FAST16_MIN,
INT_FAST16_MAX, UINT_FAST16_MAX, INT_FAST32_MIN, INT_FAST32_MAX,
UINT_FAST32_MAX, INT_FAST64_MIN, INT_FAST64_MAX, UINT_FAST64_MAX):
Correct to match logic for defining corresponding types.
(INTMAX_MAX, INTMAX_MIN, UINTMAX_MAX): Define.
(SIZE_MAX): Define using __SIZE_MAX__ if available.
(PTRDIFF_MAX): Define using __PTRDIFF_MAX__ if available.
(PTRDIFF_MIN): Define in terms of PTRDIFF_MAX.
(WCHAR_MAX, WCHAR_MIN, WINT_MAX, WINT_MIN): Define.
(UINT8_C, UINT16_C): Define to give signed values if corresponding
types would promote to int.
* 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.
* 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.
* libc/include/sys/config.h[__mips__]: Don't bother
setting __ATTRIBUTE_IMPURE_PTR__ here.
[__rtems__][__mips__]: No need to undef the __ATTRIBUTE_IMPURE_PTR__
macro anymore.
* libc/include/pthread.h: Remove prototypes for
pthread_attr_getcputime and pthread_attr_setcputime which
were proposed but never approved by the POSIX standard.
* libc/include/ctype.h (isblank): isblank is C99.
* libc/ctype/isblank.c (isblank comments): ditto. isblank does not
have a macro version (as was claimed in the description).
* libc/sys/linux/include/stdint.h (SIZE_MAX): Fix value which should
be size of size_t, not int.
(SIZE_MIN): Remove.
* libc/sys/linux/sys/stdint.h: Ditto
* libc/include/pthread.h[_UNIX98_THREAD_MUTEX_ATTRIBUTES]: Add
new pthread_mutexattr_gettype and pthread_mutexattr_settype
prototypes.
* libc/include/sys/types.h[_UNIX98_THREAD_MUTEX_ATTRIBUTES]: Add
new mutex type values.
(pthread_mutexattr_t)[_UNIX98_THREAD_MUTEX_ATTRIBUTES]: Add type
field.
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.
* libc/ctype/ctype_.c: Add new pointer __ctype_ptr__ which is one
less than the old __ctype_ptr.
* libc/ctype/isalnum.c: Use __ctype_ptr__.
* libc/ctype/isalpha.c: Ditto.
* libc/ctype/iscntrl.c: Ditto.
* libc/ctype/isdigit.c: Ditto.
* libc/ctype/islower.c: Ditto.
* libc/ctype/isprint.c: Ditto.
* libc/ctype/ispunct.c: Ditto.
* libc/ctype/isspace.c: Ditto.
* libc/ctype/isupper.c: Ditto.
* libc/ctype/isxdigit.c: Ditto.
* libc/include/ctype.h: Change ctype macros to use new __ctype_ptr__
and add declaration of __ctype_ptr__. Remove older ctype table pointers
from here even though they can still work.
* 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.
Optimize the generic and x86 memchr.
* libc/string/memchr.c (memchr) [!__OPTIMIZE_SIZE__]:
Pre-align pointer so unaligned searches aren't penalized.
* libc/machine/i386/memchr.S (memchr) [!__OPTIMIZE_SIZE__]: Word
operations are faster than repnz byte searches.
Optimize the generic and x86 strlen.
* libc/string/strlen.c (strlen) [!__OPTIMIZE_SIZE__]: Pre-align
data so unaligned searches aren't penalized.
* libc/machine/i386/strlen.S (strlen) [!__OPTIMIZE_SIZE__]:
Word operations are faster than repnz byte searches.
* libc/machine/spu/impure.c: New file, supply a non-static _impure_data.
* libc/machine/spu/Makefile.am: Add new file impure.c.
* libc/machine/spu/Makefile.in: Regenerate.
* libc/machine/spu/sys/errno.h: Define errno to be _reent_data._errno.
* libc/stdio/Makefile.am: Build vfprintf.c and vfscanf.c with
-DSTRING_ONLY defined with and without -DINTEGER_ONLY defined
to build special versions for sprintf/sscanf family functions.
* libc/stdio/Makefile.in: Regenerated.
* libc/stdio/vfprintf.c[STRING_ONLY][INTEGER_ONLY](_VFPRINTF_R):
Redefine to be _svfiprintf_r which is optimized to work with siprintf
family of functions (i.e. no I/O) and does not support floating-point.
[STRING_ONLY][!INTEGER_ONLY](_VFPRINTF_R): Redefine to be
_svfprintf_r which is optimized to work with sprintf family of
functions and not use I/O.
[STRING_ONLY](__sprint_r): New string only version of static function.
designed to work with sprintf family of functions.
* libc/stdio/vfscanf.c[STRING_ONLY][INTEGER_ONLY](_SVFSCANF_R):
Redefine to be _ssvfiscanf_r which is optimized to work with siscanf
family of functions (i.e. no I/O) and no float-point support.
[STRING_ONLY][!INTEGER_ONLY](_SVFSCANF_R): Redefine to be
__ssvfscanf_r which is optimized to work with sscanf family of
functions and does not require I/O functions.
* libc/stdio/asprintf.c: Call _svfprintf_r instead of _vfprintf_r.
* libc/stdio/snprintf.c: Ditto.
* libc/stdio/sprintf.c: Ditto.
* libc/stdio/vasnprintf.c: Ditto.
* libc/stdio/vasprintf.c: Ditto.
* libc/stdio/siprintf.c: Call _svfiprintf_r instead of _vfiprintf_r.
* libc/stdio/sniprintf.c: Ditto.
* libc/stdio/vasiprintf.c: Ditto.
* libc/stdio/vsiprintf.c: Ditto.
* libc/stdio/vsniprintf.c: Ditto.
* libc/stdio/vsprintf.c: Ditto.
* libc/stdio/local.h: Add prototypes for _svfprintf_r, _svfiprintf_r,
_ssvfscanf_r, and _ssvfiscanf_r.
* libc/stdio/sscanf.c: Call _ssvfscanf_r instead of _svfscanf_r.
* libc/stdio/vsscanf.c: Ditto.
* libc/stdio/siscanf.c: Call _ssvfiscanf_r instead of _svfiscanf_r.
* libc/stdio/vsiscanf.c: Ditto.
* 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.
* libc/include/sys/reent.h(_REENT_SMALL_CHECK_INIT): Specify
this macro completely instead of referring to CHECK_STD_INIT which
is only found in libc/stdio/local.h.
* libc/stdio/dprintf.c: Add include of local.h.
* libc/stdio/vdprintf.c: Ditto.
* libc/stdio/vdiprintf.c: Ditto.
* libc/stdlib/gdtoa-hexnan.c (hexnan): When the optional
n-char-sequence is omitted, still parse the ().
-------------------------------------------------------------------
* 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.
* libc/machine/spu/straddr.h: New file, supplies _straddr.
* libc/machine/spu/strcat.c: Use _straddr and _strcpy.
* libc/machine/spu/strcpy.c: Use _strcpy.
* libc/machine/spu/strcpy.h: Supply _strcpy for optimized SPU
str[n]cpy and str[n]cat.
* libc/machine/spu/strncat.c: Use _straddr and _strcpy.
* libc/machine/spu/strncpy.c: Use _strcpy.
* libc/machine/powerpc/vfprintf.c (_VFPRINTF_R): Prepare
for user specifying --disable-newlib-io-long-long on configure.
Call _fflush_r instead of fflush. For _mbtowc_r, pass the
reentrant pointer passed in rather than _REENT.
* 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.
* libc/machine/spu/straddr.h: New file, supplies _straddr.
* libc/machine/spu/strcat.c: Use _straddr and _strcpy.
* libc/machine/spu/strcpy.c: Use _strcpy.
* libc/machine/spu/strcpy.h: Supply _strcpy for optimized SPU
str[n]cpy and str[n]cat.
* libc/machine/spu/strncat.c: Use _straddr and _strcpy.
* libc/machine/spu/strncpy.c: Use _strcpy.
pthread_sigmask or sigprocmask depending on _POSIX_THREADS.
(sigsetjmp): Use __SIGMASK_FUNC.
(siglongjmp): Ditto.
(_setjmp): Define as macro.
(_longjmp): Ditto.
* libc/string/str-two-way.h: New file.
* libc/string/memmem.c (memmem): New file.
* libc/include/string.h (memmem): Declare for all platforms.
* libc/string/strstr.c (strstr): Provide O(n) implementation when
not optimizing for space.
* libc/string/strcasestr.c (strcasestr): Likewise.
* libc/string/Makefile.am (ELIX_SOURCES): Rename to...
(ELIX_2_SOURCES): ...this.
(ELIX_4_SOURCES): New category, for memmem.
(lib_a_SOURCES, libstring_la_SOURCES): Build new file.
(CHEWOUT_FILES): Build documentation for memmem.
* libc/string/strings.tex: Include new docs.