Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2016-08-16 16:26:01 +0300
committerCorinna Vinschen <corinna@vinschen.de>2016-08-16 16:26:01 +0300
commit1ec81984d8bf97ef405d3b9332923d82fb1164de (patch)
tree3fe5e029653506f32b04eae92fddea52df929f03 /newlib/libc/time
parent6e7ce50e0415b05736f6f56377ecb2f8147e94cc (diff)
Use era_info_t and alt_digits_t on _WANT_C99_TIME_FORMATS targets only
Using era_info_t and alt_digits_t indiscriminately in strftime and strftime_l breaks targets not wanting C99 time formats. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'newlib/libc/time')
-rw-r--r--newlib/libc/time/strftime.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/newlib/libc/time/strftime.c b/newlib/libc/time/strftime.c
index 9ff44f9b1..46c2d95e4 100644
--- a/newlib/libc/time/strftime.c
+++ b/newlib/libc/time/strftime.c
@@ -49,7 +49,8 @@ DESCRIPTION
no more than <[maxsize]> characters.
<<strftime_l>> is like <<strftime>> but creates a string in a format
-as expected in locale <[locale]>.
+as expected in locale <[locale]>. If <[locale]> is LC_GLOBAL_LOCALE or
+not a valid locale object, the behaviour is undefined.
You control the format of the output using the string at <[format]>.
<<*<[format]>>> can contain two kinds of specifications: text to be
@@ -678,7 +679,7 @@ static size_t
__strftime (CHAR *s, size_t maxsize, const CHAR *format,
const struct tm *tim_p, struct __locale_t *locale,
era_info_t **era_info, alt_digits_t **alt_digits)
-#else
+#else /* !_WANT_C99_TIME_FORMATS */
static size_t
__strftime (CHAR *s, size_t maxsize, const CHAR *format,
const struct tm *tim_p, struct __locale_t *locale)
@@ -1443,6 +1444,7 @@ _DEFUN (strftime, (s, maxsize, format, tim_p),
_CONST CHAR *__restrict format _AND
_CONST struct tm *__restrict tim_p)
{
+#ifdef _WANT_C99_TIME_FORMATS
era_info_t *era_info = NULL;
alt_digits_t *alt_digits = NULL;
size_t ret = __strftime (s, maxsize, format, tim_p, __get_current_locale (),
@@ -1452,6 +1454,10 @@ _DEFUN (strftime, (s, maxsize, format, tim_p),
if (alt_digits)
free_alt_digits (alt_digits);
return ret;
+#else /* !_WANT_C99_TIME_FORMATS */
+ return __strftime (s, maxsize, format, tim_p, __get_current_locale (),
+ NULL, NULL);
+#endif /* !_WANT_C99_TIME_FORMATS */
}
#if !defined(MAKE_WCSFTIME)
@@ -1459,6 +1465,7 @@ size_t
strftime_l (char *__restrict s, size_t maxsize, const char *__restrict format,
const struct tm *__restrict tim_p, struct __locale_t *locale)
{
+#ifdef _WANT_C99_TIME_FORMATS
era_info_t *era_info = NULL;
alt_digits_t *alt_digits = NULL;
size_t ret = __strftime (s, maxsize, format, tim_p, locale,
@@ -1468,6 +1475,9 @@ strftime_l (char *__restrict s, size_t maxsize, const char *__restrict format,
if (alt_digits)
free_alt_digits (alt_digits);
return ret;
+#else /* !_WANT_C99_TIME_FORMATS */
+ return __strftime (s, maxsize, format, tim_p, locale, NULL, NULL);
+#endif /* !_WANT_C99_TIME_FORMATS */
}
#endif