about summary refs log tree commit diff
path: root/stdlib/strfmon_l.c
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/strfmon_l.c')
-rw-r--r--stdlib/strfmon_l.c43
1 files changed, 11 insertions, 32 deletions
diff --git a/stdlib/strfmon_l.c b/stdlib/strfmon_l.c
index 58dab340cf..f6d52e0b56 100644
--- a/stdlib/strfmon_l.c
+++ b/stdlib/strfmon_l.c
@@ -1,5 +1,5 @@
 /* Formatting a monetary value according to the given locale.
-   Copyright (C) 1996, 1997, 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 2002, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -23,10 +23,8 @@
 #include <langinfo.h>
 #include <locale.h>
 #include <monetary.h>
-#ifdef USE_IN_LIBIO
-# include "../libio/libioP.h"
-# include "../libio/strfile.h"
-#endif
+#include "../libio/libioP.h"
+#include "../libio/strfile.h"
 #include <printf.h>
 #include <stdarg.h>
 #include <stdio.h>
@@ -91,13 +89,9 @@ __vstrfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format,
 	      va_list ap)
 {
   struct locale_data *current = loc->__locales[LC_MONETARY];
-#ifdef USE_IN_LIBIO
   _IO_strfile f;
-# ifdef _IO_MTSAFE_IO
+#ifdef _IO_MTSAFE_IO
   _IO_lock_t lock;
-# endif
-#else
-  FILE f;
 #endif
   struct printf_info info;
   char *dest;			/* Pointer so copy the output.  */
@@ -278,7 +272,8 @@ __vstrfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format,
       if (*fmt == 'L')
 	{
 	  ++fmt;
-	  is_long_double = 1;
+	  if (!__ldbl_is_dbl)
+	    is_long_double = 1;
 	}
 
       /* Handle format specifier.  */
@@ -515,30 +510,13 @@ __vstrfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format,
 	  out_string (sign_string);
 
       /* Print the number.  */
-#ifdef USE_IN_LIBIO
-# ifdef _IO_MTSAFE_IO
+#ifdef _IO_MTSAFE_IO
       f._sbf._f._lock = &lock;
-# endif
+#endif
       INTUSE(_IO_init) ((_IO_FILE *) &f, 0);
       _IO_JUMPS ((struct _IO_FILE_plus *) &f) = &_IO_str_jumps;
       INTUSE(_IO_str_init_static) ((_IO_strfile *) &f, dest,
 				   (s + maxsize) - dest, dest);
-#else
-      memset ((void *) &f, 0, sizeof (f));
-      f.__magic = _IOMAGIC;
-      f.__mode.__write = 1;
-      /* The buffer size is one less than MAXLEN
-	 so we have space for the null terminator.  */
-      f.__bufp = f.__buffer = (char *) dest;
-      f.__bufsize = (s + maxsize) - dest;
-      f.__put_limit = f.__buffer + f.__bufsize;
-      f.__get_limit = f.__buffer;
-      /* After the buffer is full (MAXLEN characters have been written),
-	 any more characters written will go to the bit bucket.  */
-      f.__room_funcs = __default_room_functions;
-      f.__io_funcs.__write = NULL;
-      f.__seen = 1;
-#endif
       /* We clear the last available byte so we can find out whether
 	 the numeric representation is too long.  */
       s[maxsize - 1] = '\0';
@@ -633,7 +611,7 @@ __vstrfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format,
 }
 
 ssize_t
-__strfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, ...)
+___strfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, ...)
 {
   va_list ap;
 
@@ -645,4 +623,5 @@ __strfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, ...)
 
   return res;
 }
-weak_alias (__strfmon_l, strfmon_l)
+ldbl_strong_alias (___strfmon_l, __strfmon_l)
+ldbl_weak_alias (___strfmon_l, strfmon_l)