summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2009-03-26 10:04:40 +0000
committerCorinna Vinschen <corinna@vinschen.de>2009-03-26 10:04:40 +0000
commitf6e29e076a1e0662faff14e7fe23235f4a834ff6 (patch)
treebd691d9de38537fac2e958561cca369f446a2267
parent7ca98b490133315b2b999c56eff604b655f062c0 (diff)
downloadcygnal-f6e29e076a1e0662faff14e7fe23235f4a834ff6.tar.gz
cygnal-f6e29e076a1e0662faff14e7fe23235f4a834ff6.tar.bz2
cygnal-f6e29e076a1e0662faff14e7fe23235f4a834ff6.zip
Revert erroneously checked in files.
-rw-r--r--newlib/libc/stdlib/gdtoa-gethex.c27
-rw-r--r--newlib/libc/stdlib/strtod.c10
-rw-r--r--newlib/libc/stdlib/wcstod.c22
3 files changed, 23 insertions, 36 deletions
diff --git a/newlib/libc/stdlib/gdtoa-gethex.c b/newlib/libc/stdlib/gdtoa-gethex.c
index 80f56959d..92f30fca0 100644
--- a/newlib/libc/stdlib/gdtoa-gethex.c
+++ b/newlib/libc/stdlib/gdtoa-gethex.c
@@ -35,7 +35,10 @@ THIS SOFTWARE.
#include "mprec.h"
#include "gdtoa.h"
#include "gd_qnan.h"
+
+#ifdef USE_LOCALE
#include "locale.h"
+#endif
unsigned char hexdig[256];
@@ -148,10 +151,11 @@ _DEFUN(gethex, (ptr, sp, fpi, exp, bp, sign),
int esign, havedig, irv, k, n, nbits, up, zret;
__ULong L, lostbits, *x;
Long e, e1;
- unsigned char *decimalpoint = (unsigned char *)
- localeconv()->decimal_point;
- size_t decp_len = strlen ((const char *) decimalpoint);
- unsigned char decp_end = decimalpoint[decp_len - 1];
+#ifdef USE_LOCALE
+ unsigned char decimalpoint = *localeconv()->decimal_point;
+#else
+#define decimalpoint '.'
+#endif
if (!hexdig['0'])
hexdig_init();
@@ -166,9 +170,9 @@ _DEFUN(gethex, (ptr, sp, fpi, exp, bp, sign),
e = 0;
if (!hexdig[*s]) {
zret = 1;
- if (strcmp ((const char *) s, (const char *) decimalpoint) != 0)
+ if (*s != decimalpoint)
goto pcheck;
- decpt = (s += decp_len);
+ decpt = ++s;
if (!hexdig[*s])
goto pcheck;
while(*s == '0')
@@ -180,9 +184,8 @@ _DEFUN(gethex, (ptr, sp, fpi, exp, bp, sign),
}
while(hexdig[*s])
s++;
- if (strcmp ((const char *) s, (const char *) decimalpoint) == 0
- && !decpt) {
- decpt = (s += decp_len);
+ if (*s == decimalpoint && !decpt) {
+ decpt = ++s;
while(hexdig[*s])
s++;
}
@@ -223,12 +226,8 @@ _DEFUN(gethex, (ptr, sp, fpi, exp, bp, sign),
n = 0;
L = 0;
while(s1 > s0) {
- if (*--s1 == decp_end && s1 - decp_len + 1 >= s0
- && strcmp ((const char *) s1 - decp_len + 1,
- (const char *) decimalpoint) == 0) {
- s1 -= decp_len - 1; /* Note the --s1 above! */
+ if (*--s1 == decimalpoint)
continue;
- }
if (n == 32) {
*x++ = L;
L = 0;
diff --git a/newlib/libc/stdlib/strtod.c b/newlib/libc/stdlib/strtod.c
index aca40a6a8..fb4caf86f 100644
--- a/newlib/libc/stdlib/strtod.c
+++ b/newlib/libc/stdlib/strtod.c
@@ -122,7 +122,9 @@ THIS SOFTWARE.
/* #include <fenv.h> */
/* #endif */
+#ifdef USE_LOCALE
#include "locale.h"
+#endif
#ifdef IEEE_Arith
#ifndef NO_IEEE_Scale
@@ -305,10 +307,14 @@ _DEFUN (_strtod_r, (ptr, s00, se),
else if (nd < 16)
z = 10*z + c - '0';
nd0 = nd;
- if (strcmp (s, localeconv()->decimal_point) == 0)
+#ifdef USE_LOCALE
+ if (c == *localeconv()->decimal_point)
+#else
+ if (c == '.')
+#endif
{
decpt = 1;
- c = *(s += strlen (localeconv()->decimal_point));
+ c = *++s;
if (!nd) {
for(; c == '0'; c = *++s)
nz++;
diff --git a/newlib/libc/stdlib/wcstod.c b/newlib/libc/stdlib/wcstod.c
index ca1f0b5ab..11fb922b1 100644
--- a/newlib/libc/stdlib/wcstod.c
+++ b/newlib/libc/stdlib/wcstod.c
@@ -116,10 +116,8 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
#include <_ansi.h>
#include <errno.h>
#include <stdlib.h>
-#include <string.h>
#include <wchar.h>
#include <wctype.h>
-#include <locale.h>
#include <math.h>
double
@@ -169,25 +167,9 @@ _DEFUN (_wcstod_r, (ptr, nptr, endptr),
* where it ended, count multibyte characters to find the
* corresponding position in the wide char string.
*/
- if (endptr != NULL) {
- /* The only valid multibyte char in a float converted by
- strtod/wcstod is the radix char. What we do here is,
- figure out if the radix char was in the valid leading
- float sequence in the incoming string. If so, the
- multibyte float string is strlen(radix char) - 1 bytes
- longer than the incoming wide char string has characters.
- To fix endptr, reposition end as if the radix char was
- just one byte long. The resulting difference (end - buf)
- is then equivalent to the number of valid wide characters
- in the input string. */
- len = strlen (localeconv ()->decimal_point);
- if (len > 1) {
- char *d = strstr (buf, localeconv ()->decimal_point);
- if (d && d < end)
- end -= len - 1;
- }
+ if (endptr != NULL)
+ /* XXX Assume each wide char is one byte. */
*endptr = (wchar_t *)nptr + (end - buf);
- }
_free_r(ptr, buf);