1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* time.c (localtime_with_gmtoff): fixed cross function jump.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-04-22 00:27:33 +00:00
parent a69b87e80e
commit d5704eb61a
3 changed files with 22 additions and 14 deletions

View file

@ -202,7 +202,7 @@ rb_strftime(char *s, size_t maxsize, const char *format, const struct vtm *vtm,
static short first = 1;
#ifdef POSIX_SEMANTICS
static char *savetz = NULL;
static int savetzlen = 0;
static size_t savetzlen = 0;
char *tz;
#endif /* POSIX_SEMANTICS */
#ifndef HAVE_TM_ZONE
@ -250,7 +250,7 @@ rb_strftime(char *s, size_t maxsize, const char *format, const struct vtm *vtm,
tz = getenv("TZ");
if (first) {
if (tz != NULL) {
int tzlen = strlen(tz);
size_t tzlen = strlen(tz);
savetz = (char *) malloc(tzlen + 1);
if (savetz != NULL) {
@ -263,7 +263,7 @@ rb_strftime(char *s, size_t maxsize, const char *format, const struct vtm *vtm,
}
/* if we have a saved TZ, and it is different, recapture and reset */
if (tz && savetz && (tz[0] != savetz[0] || strcmp(tz, savetz) != 0)) {
i = strlen(tz) + 1;
size_t i = strlen(tz) + 1;
if (i > savetzlen) {
savetz = (char *) realloc(savetz, i);
if (savetz) {
@ -892,7 +892,7 @@ vtm2tm_noyear(const struct vtm *vtm, struct tm *result)
tm.tm_gmtoff = NUM2LONG(vtm->utc_offset);
#endif
#if defined(HAVE_TM_ZONE)
tm.tm_zone = vtm->zone;
tm.tm_zone = (char *)vtm->zone;
#endif
*result = tm;
}