aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-01-19 18:39:38 +0000
committerUlrich Drepper <drepper@redhat.com>2003-01-19 18:39:38 +0000
commit978bd14399d7b027513676bb1ad9c8b8def71174 (patch)
tree63c80b60de2c46cd3f1240d19ececec4de77370f
parentb1a173f75e8292448bc186c502f1dd2df10ef72c (diff)
downloadglibc-978bd14399d7b027513676bb1ad9c8b8def71174.tar
glibc-978bd14399d7b027513676bb1ad9c8b8def71174.tar.gz
glibc-978bd14399d7b027513676bb1ad9c8b8def71174.tar.bz2
glibc-978bd14399d7b027513676bb1ad9c8b8def71174.zip
Update.
2003-01-19 Jim Meyering <jim@meyering.net> * time/strftime.c: (widen): Merge nearly-identical definitions. (nl_get_alt_digit) [! defined my_strftime]: Define. (my_strftime) [_NL_CURRENT]: Merge nearly-identical uses of _nl_get_alt_digit and _nl_get_walt_digit.
-rw-r--r--ChangeLog7
-rw-r--r--time/strftime.c29
2 files changed, 16 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index f162670c2b..09656b3045 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2003-01-19 Jim Meyering <jim@meyering.net>
+
+ * time/strftime.c: (widen): Merge nearly-identical definitions.
+ (nl_get_alt_digit) [! defined my_strftime]: Define.
+ (my_strftime) [_NL_CURRENT]: Merge nearly-identical uses of
+ _nl_get_alt_digit and _nl_get_walt_digit.
+
2003-01-19 Ulrich Drepper <drepper@redhat.com>
* time/strftime.c (my_strftime): Handle very large width
diff --git a/time/strftime.c b/time/strftime.c
index a3256ea245..d9ed3ffe8c 100644
--- a/time/strftime.c
+++ b/time/strftime.c
@@ -291,8 +291,11 @@ static const CHAR_T zeroes[16] = /* "0000000000000000" */
MEMCPY ((PTR) p, (const PTR) (s), _n))
#ifdef COMPILE_WIDE
-# ifdef USE_IN_EXTENDED_LOCALE_MODEL
-# define widen(os, ws, l) \
+# ifndef USE_IN_EXTENDED_LOCALE_MODEL
+# undef __mbsrtowcs_l
+# define __mbsrtowcs_l(d, s, l, st, loc) __mbsrtowcs (d, s, l, st)
+# endif
+# define widen(os, ws, l) \
{ \
mbstate_t __st; \
const char *__s = os; \
@@ -301,17 +304,6 @@ static const CHAR_T zeroes[16] = /* "0000000000000000" */
ws = alloca ((l + 1) * sizeof (wchar_t)); \
(void) __mbsrtowcs_l (ws, &__s, l, &__st, loc); \
}
-# else
-# define widen(os, ws, l) \
- { \
- mbstate_t __st; \
- const char *__s = os; \
- memset (&__st, '\0', sizeof (__st)); \
- l = __mbsrtowcs (NULL, &__s, 0, &__st); \
- ws = alloca ((l + 1) * sizeof (wchar_t)); \
- (void) __mbsrtowcs (ws, &__s, l, &__st); \
- }
-# endif
#endif
@@ -479,8 +471,10 @@ static CHAR_T const month_name[][10] =
#else
# ifdef COMPILE_WIDE
# define my_strftime wcsftime
+# define nl_get_alt_digit _nl_get_walt_digit
# else
# define my_strftime strftime
+# define nl_get_alt_digit _nl_get_alt_digit
# endif
# define ut_argument
# define ut_argument_spec
@@ -995,13 +989,8 @@ my_strftime (s, maxsize, format, tp ut_argument LOCALE_PARAM)
#ifdef _NL_CURRENT
/* Get the locale specific alternate representation of
the number NUMBER_VALUE. If none exist NULL is returned. */
-# ifdef COMPILE_WIDE
- const wchar_t *cp = _nl_get_walt_digit (number_value
- HELPER_LOCALE_ARG);
-# else
- const char *cp = _nl_get_alt_digit (number_value
- HELPER_LOCALE_ARG);
-# endif
+ const CHAR_T *cp = nl_get_alt_digit (number_value
+ HELPER_LOCALE_ARG);
if (cp != NULL)
{