mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/date/date_core.c (leap_p): surpress warning: parentheses.
* ext/date/date_core.c (date_s__parse_internal): remove unused variable "str". * ext/date/date_parse.c (parse_ddd_cb): use RSTRING_LENINT. * ext/date/date_strftime.c (date_strftime_with_tmx): remove unused variable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5c0a69a621
commit
c34db58913
4 changed files with 20 additions and 12 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
||||||
|
Sun Apr 24 01:58:01 2011 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
|
* ext/date/date_core.c (leap_p): surpress warning: parentheses.
|
||||||
|
|
||||||
|
* ext/date/date_core.c (date_s__parse_internal): remove unused
|
||||||
|
variable "str".
|
||||||
|
|
||||||
|
* ext/date/date_parse.c (parse_ddd_cb): use RSTRING_LENINT.
|
||||||
|
|
||||||
|
* ext/date/date_strftime.c (date_strftime_with_tmx): remove unused
|
||||||
|
variable.
|
||||||
|
|
||||||
Sun Apr 24 00:34:23 2011 Tadayoshi Funaba <tadf@dotrb.org>
|
Sun Apr 24 00:34:23 2011 Tadayoshi Funaba <tadf@dotrb.org>
|
||||||
|
|
||||||
* ext/date/date_parse.c: removed some unused macros. use strchr()
|
* ext/date/date_parse.c: removed some unused macros. use strchr()
|
||||||
|
|
|
@ -440,7 +440,7 @@ static const int monthtab[2][13] = {
|
||||||
inline static int
|
inline static int
|
||||||
leap_p(int y)
|
leap_p(int y)
|
||||||
{
|
{
|
||||||
return MOD(y, 4) == 0 && y % 100 != 0 || MOD(y, 400) == 0;
|
return (MOD(y, 4) == 0 && y % 100 != 0) || (MOD(y, 400) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -1434,14 +1434,12 @@ static VALUE
|
||||||
date_s__parse_internal(int argc, VALUE *argv, VALUE klass)
|
date_s__parse_internal(int argc, VALUE *argv, VALUE klass)
|
||||||
{
|
{
|
||||||
VALUE vstr, vcomp, hash;
|
VALUE vstr, vcomp, hash;
|
||||||
const char *str;
|
|
||||||
|
|
||||||
rb_scan_args(argc, argv, "11", &vstr, &vcomp);
|
rb_scan_args(argc, argv, "11", &vstr, &vcomp);
|
||||||
StringValue(vstr);
|
StringValue(vstr);
|
||||||
if (!rb_enc_str_asciicompat_p(vstr))
|
if (!rb_enc_str_asciicompat_p(vstr))
|
||||||
rb_raise(rb_eArgError,
|
rb_raise(rb_eArgError,
|
||||||
"string should have ASCII compatible encoding");
|
"string should have ASCII compatible encoding");
|
||||||
str = RSTRING_PTR(vstr);
|
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
vcomp = Qtrue;
|
vcomp = Qtrue;
|
||||||
|
|
||||||
|
|
|
@ -918,7 +918,7 @@ parse_ddd_cb(VALUE m, VALUE hash)
|
||||||
{
|
{
|
||||||
VALUE s1, s2, s3, s4, s5;
|
VALUE s1, s2, s3, s4, s5;
|
||||||
const char *cs2, *cs3, *cs5;
|
const char *cs2, *cs3, *cs5;
|
||||||
long l2, l3, l4, l5;
|
int l2, l3, l4, l5;
|
||||||
|
|
||||||
s1 = f_aref(m, INT2FIX(1));
|
s1 = f_aref(m, INT2FIX(1));
|
||||||
s2 = f_aref(m, INT2FIX(2));
|
s2 = f_aref(m, INT2FIX(2));
|
||||||
|
@ -927,7 +927,7 @@ parse_ddd_cb(VALUE m, VALUE hash)
|
||||||
s5 = f_aref(m, INT2FIX(5));
|
s5 = f_aref(m, INT2FIX(5));
|
||||||
|
|
||||||
cs2 = RSTRING_PTR(s2);
|
cs2 = RSTRING_PTR(s2);
|
||||||
l2 = RSTRING_LEN(s2);
|
l2 = RSTRING_LENINT(s2);
|
||||||
|
|
||||||
switch (l2) {
|
switch (l2) {
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -1042,7 +1042,7 @@ parse_ddd_cb(VALUE m, VALUE hash)
|
||||||
}
|
}
|
||||||
if (!NIL_P(s3)) {
|
if (!NIL_P(s3)) {
|
||||||
cs3 = RSTRING_PTR(s3);
|
cs3 = RSTRING_PTR(s3);
|
||||||
l3 = RSTRING_LEN(s3);
|
l3 = RSTRING_LENINT(s3);
|
||||||
|
|
||||||
if (!NIL_P(s4)) {
|
if (!NIL_P(s4)) {
|
||||||
switch (l3) {
|
switch (l3) {
|
||||||
|
@ -1072,7 +1072,7 @@ parse_ddd_cb(VALUE m, VALUE hash)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!NIL_P(s4)) {
|
if (!NIL_P(s4)) {
|
||||||
l4 = RSTRING_LEN(s4);
|
l4 = RSTRING_LENINT(s4);
|
||||||
|
|
||||||
set_hash("sec_fraction",
|
set_hash("sec_fraction",
|
||||||
rb_rational_new2(str2num(s4),
|
rb_rational_new2(str2num(s4),
|
||||||
|
@ -1081,7 +1081,7 @@ parse_ddd_cb(VALUE m, VALUE hash)
|
||||||
if (!NIL_P(s5)) {
|
if (!NIL_P(s5)) {
|
||||||
VALUE zone_to_diff(VALUE s);
|
VALUE zone_to_diff(VALUE s);
|
||||||
cs5 = RSTRING_PTR(s5);
|
cs5 = RSTRING_PTR(s5);
|
||||||
l5 = RSTRING_LEN(s5);
|
l5 = RSTRING_LENINT(s5);
|
||||||
|
|
||||||
set_hash("zone", s5);
|
set_hash("zone", s5);
|
||||||
|
|
||||||
|
|
|
@ -716,17 +716,15 @@ date_strftime_with_tmx(char *s, size_t maxsize, const char *format,
|
||||||
subsec = div(subsec, INT2FIX(1));
|
subsec = div(subsec, INT2FIX(1));
|
||||||
|
|
||||||
if (FIXNUM_P(subsec)) {
|
if (FIXNUM_P(subsec)) {
|
||||||
int l;
|
(void)snprintf(s, endp - s, "%0*ld", precision, FIX2LONG(subsec));
|
||||||
l = snprintf(s, endp - s, "%0*ld", precision, FIX2LONG(subsec));
|
|
||||||
s += precision;
|
s += precision;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
VALUE args[2], result;
|
VALUE args[2], result;
|
||||||
size_t l;
|
|
||||||
args[0] = INT2FIX(precision);
|
args[0] = INT2FIX(precision);
|
||||||
args[1] = subsec;
|
args[1] = subsec;
|
||||||
result = rb_str_format(2, args, rb_str_new2("%0*d"));
|
result = rb_str_format(2, args, rb_str_new2("%0*d"));
|
||||||
l = strlcpy(s, StringValueCStr(result), endp-s);
|
(void)strlcpy(s, StringValueCStr(result), endp-s);
|
||||||
s += precision;
|
s += precision;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue