This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix strtold_l/wcstold_l, plus one warning fix


Hi!

Recent *{str,wcs}told* changes broke arches where double == long double.
Fixed thusly, plus one warning fix.

2004-03-16  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/generic/strtold_l.c (STRING_TYPE, STRTOLD, __STRTOLD,
	__STRTOD, INTERNAL, INTERNAL1): Define, use them.
	[! USE_WIDE_CHAR] (INTERNAL (__STRTOLD)): Add libc_hidden_def.

	* inet/getnameinfo.c: Include stdlib.h.

--- libc/sysdeps/generic/strtold_l.c	14 Mar 2004 20:56:09 -0000	1.1
+++ libc/sysdeps/generic/strtold_l.c	15 Mar 2004 22:35:41 -0000
@@ -20,21 +20,39 @@
 #include <stdlib.h>
 #include <xlocale.h>
 
+#ifdef USE_WIDE_CHAR
+# define STRING_TYPE	wchar_t
+# define STRTOLD	wcstold_l
+# define __STRTOLD	__wcstold_l
+# define __STRTOD	__wcstod_l
+#else
+# define STRING_TYPE	char
+# define STRTOLD	strtold_l
+# define __STRTOLD	__strtold_l
+# define __STRTOD	__strtod_l
+#endif
 
-extern double ____strtod_l_internal (const char *, char **, int, __locale_t);
+#define INTERNAL(x) INTERNAL1(x)
+#define INTERNAL1(x) __##x##_internal
 
+extern double INTERNAL (__STRTOD) (const STRING_TYPE *, STRING_TYPE **,
+				   int, __locale_t);
 
 /* There is no `long double' type, use the `double' implementations.  */
 long double
-____strtold_l_internal (const char *nptr, char **endptr, int group,
-			__locale_t loc)
+INTERNAL (__STRTOLD) (const STRING_TYPE *nptr, STRING_TYPE **endptr,
+		      int group, __locale_t loc)
 {
-  return ____strtod_l_internal (nptr, endptr, group, loc);
+  return INTERNAL (__STRTOD) (nptr, endptr, group, loc);
 }
-
+#ifndef USE_WIDE_CHAR
+libc_hidden_def (INTERNAL (__STRTOLD))
+#endif
 
 long double
-strtold (const char *nptr, char **endptr, __locale_t loc)
+weak_function
+__STRTOLD (const STRING_TYPE *nptr, STRING_TYPE **endptr, __locale_t loc)
 {
-  return ____strtod_l_internal (nptr, endptr, 0, loc);
+  return INTERNAL (__STRTOD) (nptr, endptr, 0, loc);
 }
+weak_alias (__STRTOLD, STRTOLD)
--- libc/inet/getnameinfo.c	13 Mar 2004 08:46:13 -0000	1.31
+++ libc/inet/getnameinfo.c	15 Mar 2004 23:01:01 -0000
@@ -38,6 +38,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
 #include <alloca.h>
 #include <errno.h>
 #include <netdb.h>
+#include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]