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

Collapse All | Expand All

(-)a/include/time.h (+9 lines)
Lines 8-13 extern __typeof (strftime_l) __strftime_l; Link Here
8
libc_hidden_proto (__strftime_l)
8
libc_hidden_proto (__strftime_l)
9
extern __typeof (strptime_l) __strptime_l;
9
extern __typeof (strptime_l) __strptime_l;
10
10
11
/* Backward compatibility function: feature_OB argument specifies
12
   whether or not %OB format specifier should be implemented.  */
13
extern size_t __strftime_l_common (char *__restrict __s, size_t __maxsize,
14
				   const char *__restrict __format,
15
				   const struct tm *__restrict __tp,
16
				   const int feature_OB,
17
				   locale_t __loc) __THROW;
18
libc_hidden_proto (__strftime_l_common)
19
11
libc_hidden_proto (time)
20
libc_hidden_proto (time)
12
libc_hidden_proto (asctime)
21
libc_hidden_proto (asctime)
13
libc_hidden_proto (mktime)
22
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 791-803 __strftime_internal (CHAR_T *s, size_t maxsize, const CHAR_T *format, Link Here
791
	case L_('B'):
800
	case L_('B'):
792
	  if (modifier == L_('E'))
801
	  if (modifier == L_('E'))
793
	    goto bad_format;
802
	    goto bad_format;
803
	  if (!feature_OB && modifier == L_('O'))
804
	    goto bad_format;
794
	  if (change_case)
805
	  if (change_case)
795
	    {
806
	    {
796
	      to_uppcase = 1;
807
	      to_uppcase = 1;
797
	      to_lowcase = 0;
808
	      to_lowcase = 0;
798
	    }
809
	    }
799
#if defined _NL_CURRENT || !HAVE_STRFTIME
810
#if defined _NL_CURRENT || !HAVE_STRFTIME
800
	  if (modifier == L_('O'))
811
	  if (!feature_OB || modifier == L_('O'))
801
	    cpy (STRLEN (f_altmonth), f_altmonth);
812
	    cpy (STRLEN (f_altmonth), f_altmonth);
802
	  else
813
	  else
803
	    cpy (STRLEN (f_month), f_month);
814
	    cpy (STRLEN (f_month), f_month);
Lines 829-838 __strftime_internal (CHAR_T *s, size_t maxsize, const CHAR_T *format, Link Here
829
	    CHAR_T *old_start = p;
840
	    CHAR_T *old_start = p;
830
	    size_t len = __strftime_internal (NULL, (size_t) -1, subfmt,
841
	    size_t len = __strftime_internal (NULL, (size_t) -1, subfmt,
831
					      tp, tzset_called ut_argument
842
					      tp, tzset_called ut_argument
832
					      LOCALE_ARG);
843
					      FEATURE_OB_ARG LOCALE_ARG);
833
	    add (len, __strftime_internal (p, maxsize - i, subfmt,
844
	    add (len, __strftime_internal (p, maxsize - i, subfmt,
834
					   tp, tzset_called ut_argument
845
					   tp, tzset_called ut_argument
835
					   LOCALE_ARG));
846
					   FEATURE_OB_ARG LOCALE_ARG));
836
847
837
	    if (to_uppcase)
848
	    if (to_uppcase)
838
	      while (old_start < p)
849
	      while (old_start < p)
Lines 1433-1442 size_t Link Here
1433
emacs_strftime (char *s, size_t maxsize, const char *format,
1444
emacs_strftime (char *s, size_t maxsize, const char *format,
1434
		const struct tm *tp)
1445
		const struct tm *tp)
1435
{
1446
{
1436
  return my_strftime (s, maxsize, format, tp, 0);
1447
  return my_strftime (s, maxsize, format, tp, 1, 0);
1437
}
1448
}
1438
#endif
1449
#endif
1439
1450
1440
#if defined _LIBC && !defined COMPILE_WIDE
1451
#if defined _LIBC && !defined COMPILE_WIDE
1441
weak_alias (__strftime_l, strftime_l)
1452
size_t
1453
__strftime_l_internal (char *s, size_t maxsize, const char *format,
1454
		       const struct tm *tp, locale_t loc)
1455
{
1456
  return my_strftime (s, maxsize, format, tp, 1, loc);
1457
}
1458
strong_alias (__strftime_l_internal, __strftime_l_internal_alias)
1459
versioned_symbol (libc, __strftime_l_internal_alias,
1460
		  __strftime_l, GLIBC_2_26);
1461
libc_hidden_ver (__strftime_l_internal_alias, __strftime_l)
1462
versioned_symbol (libc, __strftime_l_internal, strftime_l, GLIBC_2_26);
1463
libc_hidden_ver (__strftime_l_internal, strftime_l)
1464
1465
# if SHLIB_COMPAT (libc, GLIBC_2_3, GLIBC_2_26)
1466
size_t
1467
attribute_compat_text_section
1468
__strftime_l_compat (char *s, size_t maxsize, const char *format,
1469
		     const struct tm *tp, locale_t loc)
1470
{
1471
  return my_strftime (s, maxsize, format, tp, 0, loc);
1472
}
1473
strong_alias (__strftime_l_compat, __strftime_l_compat_alias)
1474
compat_symbol (libc, __strftime_l_compat_alias, __strftime_l, GLIBC_2_3);
1475
compat_symbol (libc, __strftime_l_compat, strftime_l, GLIBC_2_3);
1476
# endif
1477
1442
#endif
1478
#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