ruby-changes:22840
From: tadf <ko1@a...>
Date: Sat, 3 Mar 2012 12:22:04 +0900 (JST)
Subject: [ruby-changes:22840] tadf:r34889 (trunk): * ext/date/date_strftime.c: reassigned some variables.
tadf 2012-03-03 12:21:53 +0900 (Sat, 03 Mar 2012) New Revision: 34889 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=34889 Log: * ext/date/date_strftime.c: reassigned some variables. Modified files: trunk/ChangeLog trunk/ext/date/date_strftime.c Index: ChangeLog =================================================================== --- ChangeLog (revision 34888) +++ ChangeLog (revision 34889) @@ -1,3 +1,7 @@ +Sat Mar 3 12:20:44 2012 Tadayoshi Funaba <tadf@d...> + + * ext/date/date_strftime.c: reassigned some variables. + Sat Mar 3 12:12:16 2012 Tadayoshi Funaba <tadf@d...> * ext/date/date_{parse,strptime}.c [ruby-dev:45303]. Index: ext/date/date_strftime.c =================================================================== --- ext/date/date_strftime.c (revision 34888) +++ ext/date/date_strftime.c (revision 34889) @@ -177,9 +177,8 @@ char *start = s; const char *sp, *tp; auto char tbuf[100]; - long off; ptrdiff_t i; - int w; + int v, w; int precision, flags, colons; char padding; enum {LEFT, CHCASE, LOWER, UPPER, LOCALE_O, LOCALE_E}; @@ -358,22 +357,22 @@ continue; case 'd': /* day of the month, 01 - 31 */ - i = range(1, tmx_mday, 31); - FMT('0', 2, "d", (int)i); + v = range(1, tmx_mday, 31); + FMT('0', 2, "d", v); continue; case 'H': /* hour, 24-hour clock, 00 - 23 */ - i = range(0, tmx_hour, 23); - FMT('0', 2, "d", (int)i); + v = range(0, tmx_hour, 23); + FMT('0', 2, "d", v); continue; case 'I': /* hour, 12-hour clock, 01 - 12 */ - i = range(0, tmx_hour, 23); - if (i == 0) - i = 12; - else if (i > 12) - i -= 12; - FMT('0', 2, "d", (int)i); + v = range(0, tmx_hour, 23); + if (v == 0) + v = 12; + else if (v > 12) + v -= 12; + FMT('0', 2, "d", v); continue; case 'j': /* day of the year, 001 - 366 */ @@ -381,13 +380,13 @@ continue; case 'm': /* month, 01 - 12 */ - i = range(1, tmx_mon, 12); - FMT('0', 2, "d", (int)i); + v = range(1, tmx_mon, 12); + FMT('0', 2, "d", v); continue; case 'M': /* minute, 00 - 59 */ - i = range(0, tmx_min, 59); - FMT('0', 2, "d", (int)i); + v = range(0, tmx_min, 59); + FMT('0', 2, "d", v); continue; case 'p': /* AM or PM based on 12-hour clock */ @@ -397,8 +396,8 @@ flags &= ~(BIT_OF(UPPER)|BIT_OF(CHCASE)); flags |= BIT_OF(LOWER); } - i = range(0, tmx_hour, 23); - if (i < 12) + v = range(0, tmx_hour, 23); + if (v < 12) tp = ampm[0]; else tp = ampm[1]; @@ -414,8 +413,8 @@ continue; case 'S': /* second, 00 - 59 */ - i = range(0, tmx_sec, 59); - FMT('0', 2, "d", (int)i); + v = range(0, tmx_sec, 59); + FMT('0', 2, "d", v); continue; case 'U': /* week of year, Sunday is first day of week */ @@ -423,8 +422,8 @@ continue; case 'w': /* weekday, Sunday == 0, 0 - 6 */ - i = range(0, tmx_wday, 6); - FMT('0', 1, "d", (int)i); + v = range(0, tmx_wday, 6); + FMT('0', 1, "d", v); continue; case 'W': /* week of year, Monday is first day of week */ @@ -440,8 +439,8 @@ continue; case 'y': /* year without a century, 00 - 99 */ - i = NUM2INT(mod(tmx_year, INT2FIX(100))); - FMT('0', 2, "d", (int)i); + v = NUM2INT(mod(tmx_year, INT2FIX(100))); + FMT('0', 2, "d", v); continue; case 'Y': /* year with century */ @@ -460,7 +459,7 @@ #ifdef MAILHEADER_EXT case 'z': /* time zone offset east of GMT e.g. -0600 */ { - long aoff; + long off, aoff; int hl, hw; off = NUM2LONG(rb_funcall(tmx_offset, rb_intern("round"), 0)); @@ -599,17 +598,17 @@ #ifdef SUNOS_EXT case 'k': /* hour, 24-hour clock, blank pad */ - i = range(0, tmx_hour, 23); - FMT(' ', 2, "d", (int)i); + v = range(0, tmx_hour, 23); + FMT(' ', 2, "d", v); continue; case 'l': /* hour, 12-hour clock, 1 - 12, blank pad */ - i = range(0, tmx_hour, 23); - if (i == 0) - i = 12; - else if (i > 12) - i -= 12; - FMT(' ', 2, "d", (int)i); + v = range(0, tmx_hour, 23); + if (v == 0) + v = 12; + else if (v > 12) + v -= 12; + FMT(' ', 2, "d", v); continue; #endif @@ -649,8 +648,8 @@ #ifdef ISO_DATE_EXT case 'g': /* year of ISO week without a century */ - i = NUM2INT(mod(tmx_cwyear, INT2FIX(100))); - FMT('0', 2, "d", (int)i); + v = NUM2INT(mod(tmx_cwyear, INT2FIX(100))); + FMT('0', 2, "d", v); continue; case 'G': /* year of ISO week with century */ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/