date_core testing address not value of variable on stack
This line appears ten times in date_core.c:
decode_year(y, ns ? -1 : +1, &nth2, ry);
The type of ns is int*, and it seems to always be populated with the address of a stack variable, with the effect that the condition is always true. It looks like the intent is to ensure that decode_year uses Gregorian years if the value ns is true, i.e.:
decode_year(y, *ns ? -1 : +1, &nth2, ry);
It may be the case that this code is unreachable: guess_style() would have to return zero and nth would have to be calculated to be greater or less than zero. Is there any way that could happen?
* ext/date/date_core.c: fixed a bug . reported by Riley Lynch. * ext/date/date_core.c: fixed coding error . reported by Riley Lynch.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@41952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e