diff options
author | Ulrich Drepper <drepper@redhat.com> | 1998-09-24 18:06:23 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1998-09-24 18:06:23 +0000 |
commit | e503270ca511dd3092c953fe5f9a178f0d04b1ad (patch) | |
tree | 6aad2eb1bbbfe632bd3db496e614e7314537764e /time | |
parent | 3465c0ce37f534b4b1b9fa6cfd07fb3e88e2dcc0 (diff) | |
download | glibc-e503270ca511dd3092c953fe5f9a178f0d04b1ad.tar.gz |
Update.
1998-09-24 Ulrich Drepper <drepper@cygnus.com>
* debug/catchsegv.sh: Also produce output if cloned process died.
1998-09-24 Paul Eggert <eggert@twinsun.com>
* strftime.c (f_wkday): Remove duplicate definition.
(f_wkday, f_month, a_wkday, a_month, ampm): Define as macros when
!defined _NL_CURRENT && !HAVE_STRFTIME; this propagates the
1998-09-11 fix to this case.
(wkday_len, month_len): Remove these macros; they're no longer needed.
1998-09-24 Paul Eggert <eggert@twinsun.com>
* strftime.c (my_strftime): Don't store past the end of a
zero-sized buffer.
* time/strftime.c (underlying_strftime):
* time/strftime.c (INT_STRLEN_BOUND): Fix typo by changing 100 to 1000.
Diffstat (limited to 'time')
-rw-r--r-- | time/strftime.c | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/time/strftime.c b/time/strftime.c index 61f688e1b2..04d0e565df 100644 --- a/time/strftime.c +++ b/time/strftime.c @@ -416,15 +416,14 @@ my_strftime (s, maxsize, format, tp) { int hour12 = tp->tm_hour; #ifdef _NL_CURRENT - /* We cannot make the following values variables since we must dealy + /* We cannot make the following values variables since we must delay the evaluation of these values until really needed since some expressions might not be valid in every situation. The `struct tm' - might be generated by a strptime() call and therefore initialized + might be generated by a strptime() call that initialized only a few elements. Dereference the pointers only if the format requires this. Then it is ok to fail if the pointers are invalid. */ # define a_wkday _NL_CURRENT (LC_TIME, ABDAY_1 + tp->tm_wday) # define f_wkday _NL_CURRENT (LC_TIME, DAY_1 + tp->tm_wday) -# define f_wkday _NL_CURRENT (LC_TIME, DAY_1 + tp->tm_wday) # define a_month _NL_CURRENT (LC_TIME, ABMON_1 + tp->tm_mon) # define f_month _NL_CURRENT (LC_TIME, MON_1 + tp->tm_mon) # define ampm _NL_CURRENT (LC_TIME, tp->tm_hour > 11 ? PM_STR : AM_STR) @@ -432,22 +431,17 @@ my_strftime (s, maxsize, format, tp) # define aw_len strlen (a_wkday) # define am_len strlen (a_month) # define ap_len strlen (ampm) - -# define wkday_len strlen (f_wkday) -# define month_len strlen (f_month) #else # if !HAVE_STRFTIME - const char *const f_wkday = weekday_name[tp->tm_wday]; - const char *const f_month = month_name[tp->tm_mon]; - const char *const a_wkday = f_wkday; - const char *const a_month = f_month; - const char *const ampm = "AMPM" + 2 * (hour12 > 11); +# define f_wkday (weekday_name[tp->tm_wday]) +# define f_month (month_name[tp->tm_mon]) +# define a_wkday f_wkday +# define a_month f_month +# define ampm ("AMPM" + 2 * (tp->tm_hour > 11)) + size_t aw_len = 3; size_t am_len = 3; size_t ap_len = 2; - - size_t wkday_len = strlen (f_wkday); - size_t month_len = strlen (f_month); # endif #endif const char *zone; @@ -669,7 +663,7 @@ my_strftime (s, maxsize, format, tp) to_lowcase = 0; } #if defined _NL_CURRENT || !HAVE_STRFTIME - cpy (wkday_len, f_wkday); + cpy (strlen (f_wkday), f_wkday); break; #else goto underlying_strftime; @@ -695,7 +689,7 @@ my_strftime (s, maxsize, format, tp) to_lowcase = 0; } #if defined _NL_CURRENT || !HAVE_STRFTIME - cpy (month_len, f_month); + cpy (strlen (f_month), f_month); break; #else goto underlying_strftime; @@ -1227,7 +1221,7 @@ my_strftime (s, maxsize, format, tp) } } - if (p) + if (p && i < maxsize) *p = '\0'; return i; } |