Project

General

Profile

Bug #5171 » 0001-ext-date-date_strftime.c-date_strftime_with_tmx-RB_G.patch

extra safety fix for tmx_zone - normalperson (Eric Wong), 08/09/2011 09:55 AM

View differences:

ext/date/date_core.c
return INT2FIX(m_of(x));
}
static char *
tmx_m_zone(union DateData *x)
{
return RSTRING_PTR(m_zone(x));
}
static struct tmx_funcs tmx_funcs = {
(VALUE (*)(void *))m_real_year,
(int (*)(void *))m_yday,
......
(VALUE (*)(void *))tmx_m_secs,
(VALUE (*)(void *))tmx_m_msecs,
(VALUE (*)(void *))tmx_m_of,
(char *(*)(void *))tmx_m_zone
(VALUE (*)(void *))m_zone
};
static void
ext/date/date_strftime.c
int precision, flags, colons;
char padding;
enum {LEFT, CHCASE, LOWER, UPPER, LOCALE_O, LOCALE_E};
VALUE zone;
#define BIT_OF(n) (1U<<(n))
/* various tables, useful in North America */
......
flags &= ~(BIT_OF(UPPER)|BIT_OF(CHCASE));
flags |= BIT_OF(LOWER);
}
{
char *zone = tmx_zone;
if (zone == NULL)
tp = "";
else
tp = zone;
i = strlen(tp);
}
zone = tmx_zone;
RB_GC_GUARD(zone); /* not needed as of 2011-08-08 */
tp = RSTRING_PTR(zone);
i = RSTRING_LEN(zone);
break;
#ifdef SYSV_EXT
(2-2/2)