View | Details | Raw Unified | Return to bug 10871 | Differences between
and this patch

Collapse All | Expand All

(-)a/include/time.h (+9 lines)
Lines 10-15 extern __typeof (strftime_l) __strftime_l; Link Here
10
libc_hidden_proto (__strftime_l)
10
libc_hidden_proto (__strftime_l)
11
extern __typeof (strptime_l) __strptime_l;
11
extern __typeof (strptime_l) __strptime_l;
12
12
13
/* Backward compatibility function: feature_OB argument specifies
14
   whether or not %OB format specifier should be implemented.  */
15
extern size_t __strftime_l_common (char *__restrict __s, size_t __maxsize,
16
				   const char *__restrict __format,
17
				   const struct tm *__restrict __tp,
18
				   const int feature_OB,
19
				   __locale_t __loc) __THROW;
20
libc_hidden_proto (__strftime_l_common)
21
13
libc_hidden_proto (time)
22
libc_hidden_proto (time)
14
libc_hidden_proto (asctime)
23
libc_hidden_proto (asctime)
15
libc_hidden_proto (mktime)
24
libc_hidden_proto (mktime)
(-)a/include/wchar.h (+9 lines)
Lines 25-30 libc_hidden_proto (__wcstof_l) Link Here
25
libc_hidden_proto (__wcstold_l)
25
libc_hidden_proto (__wcstold_l)
26
libc_hidden_proto (__wcsftime_l)
26
libc_hidden_proto (__wcsftime_l)
27
27
28
/* Backward compatibility function: feature_OB argument specifies
29
   whether or not %OB format specifier should be implemented.  */
30
extern size_t __wcsftime_l_common (wchar_t *__restrict __s, size_t __maxsize,
31
				   const wchar_t *__restrict __format,
32
				   const struct tm *__restrict __tp,
33
				   const int feature_OB,
34
				   __locale_t __loc) __THROW;
35
libc_hidden_proto (__wcsftime_l_common)
36
28
37
29
extern double __wcstod_internal (const wchar_t *__restrict __nptr,
38
extern double __wcstod_internal (const wchar_t *__restrict __nptr,
30
				 wchar_t **__restrict __endptr, int __group)
39
				 wchar_t **__restrict __endptr, int __group)
(-)a/time/Versions (+4 lines)
Lines 65-68 libc { Link Here
65
  GLIBC_2.16 {
65
  GLIBC_2.16 {
66
    timespec_get;
66
    timespec_get;
67
  }
67
  }
68
  GLIBC_2.26 {
69
    __strftime_l; __wcsftime_l;
70
    strftime; strftime_l; wcsftime; wcsftime_l;
71
  }
68
}
72
}
(-)a/time/strftime.c (-3 / +17 lines)
Lines 17-27 Link Here
17
17
18
#include <time.h>
18
#include <time.h>
19
#include <locale/localeinfo.h>
19
#include <locale/localeinfo.h>
20
#include <shlib-compat.h>
20
21
21
22
22
size_t
23
size_t
23
strftime (char *s, size_t maxsize, const char *format, const struct tm *tp)
24
__strftime (char *s, size_t maxsize, const char *format, const struct tm *tp)
24
{
25
{
25
  return __strftime_l (s, maxsize, format, tp, _NL_CURRENT_LOCALE);
26
  return __strftime_l_common (s, maxsize, format, tp, 1, _NL_CURRENT_LOCALE);
26
}
27
}
27
libc_hidden_def (strftime)
28
versioned_symbol (libc, __strftime, strftime, GLIBC_2_26);
29
libc_hidden_ver (__strftime, strftime)
30
31
32
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_26)
33
size_t
34
attribute_compat_text_section
35
__strftime_compat (char *s, size_t maxsize, const char *format,
36
		   const struct tm *tp)
37
{
38
  return __strftime_l_common (s, maxsize, format, tp, 0, _NL_CURRENT_LOCALE);
39
}
40
compat_symbol (libc, __strftime_compat, strftime, GLIBC_2_0);
41
#endif
(-)a/time/strftime_l.c (-10 / +46 lines)
Lines 56-61 Link Here
56
extern char *tzname[];
56
extern char *tzname[];
57
#endif
57
#endif
58
58
59
#include <shlib-compat.h>
60
59
/* Do multibyte processing if multibytes are supported, unless
61
/* Do multibyte processing if multibytes are supported, unless
60
   multibyte sequences are safe in formats.  Multibyte sequences are
62
   multibyte sequences are safe in formats.  Multibyte sequences are
61
   safe if they cannot contain byte sequences that look like format
63
   safe if they cannot contain byte sequences that look like format
Lines 279-293 static const CHAR_T zeroes[16] = /* "0000000000000000" */ Link Here
279
   function gets as an additional argument the locale which has to be
281
   function gets as an additional argument the locale which has to be
280
   used.  To access the values we have to redefine the _NL_CURRENT
282
   used.  To access the values we have to redefine the _NL_CURRENT
281
   macro.  */
283
   macro.  */
282
# define strftime		__strftime_l
284
# define strftime		__strftime_l_common
283
# define wcsftime		__wcsftime_l
285
# define wcsftime		__wcsftime_l_common
284
# undef _NL_CURRENT
286
# undef _NL_CURRENT
285
# define _NL_CURRENT(category, item) \
287
# define _NL_CURRENT(category, item) \
286
  (current->values[_NL_ITEM_INDEX (item)].string)
288
  (current->values[_NL_ITEM_INDEX (item)].string)
289
# define FEATURE_OB_PARAM , int feature_OB
290
# define FEATURE_OB_ARG , feature_OB
287
# define LOCALE_PARAM , __locale_t loc
291
# define LOCALE_PARAM , __locale_t loc
288
# define LOCALE_ARG , loc
292
# define LOCALE_ARG , loc
289
# define HELPER_LOCALE_ARG  , current
293
# define HELPER_LOCALE_ARG  , current
290
#else
294
#else
295
# define FEATURE_OB_PARAM
296
# define FEATURE_OB_ARG
291
# define LOCALE_PARAM
297
# define LOCALE_PARAM
292
# define LOCALE_ARG
298
# define LOCALE_ARG
293
# ifdef _LIBC
299
# ifdef _LIBC
Lines 435-440 static CHAR_T const month_name[][10] = Link Here
435
static size_t __strftime_internal (CHAR_T *, size_t, const CHAR_T *,
441
static size_t __strftime_internal (CHAR_T *, size_t, const CHAR_T *,
436
				   const struct tm *, bool *
442
				   const struct tm *, bool *
437
				   ut_argument_spec
443
				   ut_argument_spec
444
				   FEATURE_OB_PARAM
438
				   LOCALE_PARAM) __THROW;
445
				   LOCALE_PARAM) __THROW;
439
446
440
/* Write information from TP into S according to the format
447
/* Write information from TP into S according to the format
Lines 446-452 static size_t __strftime_internal (CHAR_T *, size_t, const CHAR_T *, Link Here
446
453
447
size_t
454
size_t
448
my_strftime (CHAR_T *s, size_t maxsize, const CHAR_T *format,
455
my_strftime (CHAR_T *s, size_t maxsize, const CHAR_T *format,
449
	     const struct tm *tp ut_argument_spec LOCALE_PARAM)
456
	     const struct tm *tp ut_argument_spec FEATURE_OB_PARAM LOCALE_PARAM)
450
{
457
{
451
#if !defined _LIBC && HAVE_TZNAME && HAVE_TZSET
458
#if !defined _LIBC && HAVE_TZNAME && HAVE_TZSET
452
  /* Solaris 2.5 tzset sometimes modifies the storage returned by localtime.
459
  /* Solaris 2.5 tzset sometimes modifies the storage returned by localtime.
Lines 457-463 my_strftime (CHAR_T *s, size_t maxsize, const CHAR_T *format, Link Here
457
#endif
464
#endif
458
  bool tzset_called = false;
465
  bool tzset_called = false;
459
  return __strftime_internal (s, maxsize, format, tp, &tzset_called
466
  return __strftime_internal (s, maxsize, format, tp, &tzset_called
460
			      ut_argument LOCALE_ARG);
467
			      ut_argument FEATURE_OB_ARG LOCALE_ARG);
461
}
468
}
462
#ifdef _LIBC
469
#ifdef _LIBC
463
libc_hidden_def (my_strftime)
470
libc_hidden_def (my_strftime)
Lines 466-475 libc_hidden_def (my_strftime) Link Here
466
static size_t
473
static size_t
467
__strftime_internal (CHAR_T *s, size_t maxsize, const CHAR_T *format,
474
__strftime_internal (CHAR_T *s, size_t maxsize, const CHAR_T *format,
468
		     const struct tm *tp, bool *tzset_called
475
		     const struct tm *tp, bool *tzset_called
469
		     ut_argument_spec LOCALE_PARAM)
476
		     ut_argument_spec FEATURE_OB_PARAM LOCALE_PARAM)
470
{
477
{
471
#if defined _LIBC && defined USE_IN_EXTENDED_LOCALE_MODEL
478
#if defined _LIBC && defined USE_IN_EXTENDED_LOCALE_MODEL
472
  struct __locale_data *const current = loc->__locales[LC_TIME];
479
  struct __locale_data *const current = loc->__locales[LC_TIME];
480
#else
481
# define feature_OB 1
473
#endif
482
#endif
474
483
475
  int hour12 = tp->tm_hour;
484
  int hour12 = tp->tm_hour;
Lines 781-793 __strftime_internal (CHAR_T *s, size_t maxsize, const CHAR_T *format, Link Here
781
	case L_('B'):
790
	case L_('B'):
782
	  if (modifier == L_('E'))
791
	  if (modifier == L_('E'))
783
	    goto bad_format;
792
	    goto bad_format;
793
	  if (!feature_OB && modifier == L_('O'))
794
	    goto bad_format;
784
	  if (change_case)
795
	  if (change_case)
785
	    {
796
	    {
786
	      to_uppcase = 1;
797
	      to_uppcase = 1;
787
	      to_lowcase = 0;
798
	      to_lowcase = 0;
788
	    }
799
	    }
789
#if defined _NL_CURRENT || !HAVE_STRFTIME
800
#if defined _NL_CURRENT || !HAVE_STRFTIME
790
	  if (modifier == L_('O'))
801
	  if (!feature_OB || modifier == L_('O'))
791
	    cpy (STRLEN (f_altmonth), f_altmonth);
802
	    cpy (STRLEN (f_altmonth), f_altmonth);
792
	  else
803
	  else
793
	    cpy (STRLEN (f_month), f_month);
804
	    cpy (STRLEN (f_month), f_month);
Lines 819-828 __strftime_internal (CHAR_T *s, size_t maxsize, const CHAR_T *format, Link Here
819
	    CHAR_T *old_start = p;
830
	    CHAR_T *old_start = p;
820
	    size_t len = __strftime_internal (NULL, (size_t) -1, subfmt,
831
	    size_t len = __strftime_internal (NULL, (size_t) -1, subfmt,
821
					      tp, tzset_called ut_argument
832
					      tp, tzset_called ut_argument
822
					      LOCALE_ARG);
833
					      FEATURE_OB_ARG LOCALE_ARG);
823
	    add (len, __strftime_internal (p, maxsize - i, subfmt,
834
	    add (len, __strftime_internal (p, maxsize - i, subfmt,
824
					   tp, tzset_called ut_argument
835
					   tp, tzset_called ut_argument
825
					   LOCALE_ARG));
836
					   FEATURE_OB_ARG LOCALE_ARG));
826
837
827
	    if (to_uppcase)
838
	    if (to_uppcase)
828
	      while (old_start < p)
839
	      while (old_start < p)
Lines 1423-1432 size_t Link Here
1423
emacs_strftime (char *s, size_t maxsize, const char *format,
1434
emacs_strftime (char *s, size_t maxsize, const char *format,
1424
		const struct tm *tp)
1435
		const struct tm *tp)
1425
{
1436
{
1426
  return my_strftime (s, maxsize, format, tp, 0);
1437
  return my_strftime (s, maxsize, format, tp, 1, 0);
1427
}
1438
}
1428
#endif
1439
#endif
1429
1440
1430
#if defined _LIBC && !defined COMPILE_WIDE
1441
#if defined _LIBC && !defined COMPILE_WIDE
1431
weak_alias (__strftime_l, strftime_l)
1442
size_t
1443
__strftime_l_internal (char *s, size_t maxsize, const char *format,
1444
		       const struct tm *tp, __locale_t loc)
1445
{
1446
  return my_strftime (s, maxsize, format, tp, 1, loc);
1447
}
1448
strong_alias (__strftime_l_internal, __strftime_l_internal_alias)
1449
versioned_symbol (libc, __strftime_l_internal_alias,
1450
		  __strftime_l, GLIBC_2_26);
1451
libc_hidden_ver (__strftime_l_internal_alias, __strftime_l)
1452
versioned_symbol (libc, __strftime_l_internal, strftime_l, GLIBC_2_26);
1453
libc_hidden_ver (__strftime_l_internal, strftime_l)
1454
1455
# if SHLIB_COMPAT (libc, GLIBC_2_3, GLIBC_2_26)
1456
size_t
1457
attribute_compat_text_section
1458
__strftime_l_compat (char *s, size_t maxsize, const char *format,
1459
		     const struct tm *tp, __locale_t loc)
1460
{
1461
  return my_strftime (s, maxsize, format, tp, 0, loc);
1462
}
1463
strong_alias (__strftime_l_compat, __strftime_l_compat_alias)
1464
compat_symbol (libc, __strftime_l_compat_alias, __strftime_l, GLIBC_2_3);
1465
compat_symbol (libc, __strftime_l_compat, strftime_l, GLIBC_2_3);
1466
# endif
1467
1432
#endif
1468
#endif
(-)a/time/wcsftime.c (-4 / +18 lines)
Lines 17-28 Link Here
17
17
18
#include <wchar.h>
18
#include <wchar.h>
19
#include <locale/localeinfo.h>
19
#include <locale/localeinfo.h>
20
#include <shlib-compat.h>
20
21
21
22
22
size_t
23
size_t
23
wcsftime (wchar_t *s, size_t maxsize, const wchar_t *format,
24
__wcsftime (wchar_t *s, size_t maxsize, const wchar_t *format,
24
	  const struct tm *tp)
25
	    const struct tm *tp)
25
{
26
{
26
  return __wcsftime_l (s, maxsize, format, tp, _NL_CURRENT_LOCALE);
27
  return __wcsftime_l_common (s, maxsize, format, tp, 1, _NL_CURRENT_LOCALE);
27
}
28
}
28
libc_hidden_def (wcsftime)
29
versioned_symbol (libc, __wcsftime, wcsftime, GLIBC_2_26);
30
libc_hidden_ver (__wcsftime, wcsftime)
31
32
33
#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_26)
34
size_t
35
attribute_compat_text_section
36
__wcsftime_compat (wchar_t *s, size_t maxsize, const wchar_t *format,
37
		   const struct tm *tp)
38
{
39
  return __wcsftime_l_common (s, maxsize, format, tp, 0, _NL_CURRENT_LOCALE);
40
}
41
compat_symbol (libc, __wcsftime_compat, wcsftime, GLIBC_2_2);
42
#endif
(-)a/time/wcsftime_l.c (-2 / +25 lines)
Lines 22-25 Link Here
22
#define COMPILE_WIDE	1
22
#define COMPILE_WIDE	1
23
#include "strftime_l.c"
23
#include "strftime_l.c"
24
24
25
weak_alias (__wcsftime_l, wcsftime_l)
25
size_t
26
__wcsftime_l_internal (wchar_t *s, size_t maxsize, const wchar_t *format,
27
		       const struct tm *tp, __locale_t loc)
28
{
29
  return my_strftime (s, maxsize, format, tp, 1, loc);
30
}
31
strong_alias (__wcsftime_l_internal, __wcsftime_l_internal_alias)
32
versioned_symbol (libc, __wcsftime_l_internal_alias,
33
		  __wcsftime_l, GLIBC_2_26);
34
libc_hidden_ver (__wcsftime_l_internal_alias, __wcsftime_l)
35
versioned_symbol (libc, __wcsftime_l_internal, wcsftime_l, GLIBC_2_26);
36
libc_hidden_ver (__wcsftime_l_internal, wcsftime_l)
37
38
#if SHLIB_COMPAT (libc, GLIBC_2_3, GLIBC_2_26)
39
size_t
40
attribute_compat_text_section
41
__wcsftime_l_compat (wchar_t *s, size_t maxsize, const wchar_t *format,
42
		     const struct tm *tp, __locale_t loc)
43
{
44
  return my_strftime (s, maxsize, format, tp, 0, loc);
45
}
46
strong_alias (__wcsftime_l_compat, __wcsftime_l_compat_alias)
47
compat_symbol (libc, __wcsftime_l_compat_alias, __wcsftime_l, GLIBC_2_3);
48
compat_symbol (libc, __wcsftime_l_compat, wcsftime_l, GLIBC_2_3);
49
#endif
26
- 

Return to bug 10871