Re: Possible tweak for tm2unixtime.c
| From: | Derick Rethans | Date: | Tue, 11 Mar 2014 10:45:00 +0000 |
| Subject: | Re: Possible tweak for tm2unixtime.c | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-73061@lists.php.net to get a copy of this message | ||
On Tue, 11 Mar 2014, Tjerk Meesters wrote:
>
> On Tue, Mar 11, 2014 at 5:42 PM, Kris Craig <kris.craig@gmail.com> wrote:
> >
> > On Tue, Mar 11, 2014 at 2:11 AM, Tjerk Meesters <tjerk.meesters@gmail.com>wrote:
> >
> >> On Tue, Mar 11, 2014 at 2:14 PM, Tig <tigger.on@gmail.com> wrote:
> >>
> >> > Hello. I'm not sure, but I believe the following
do {}
> >> > while code is
> >> > pointless in /ext/date/lib/tm2unixtime.c (located here:
> >> >
> >> > https://github.com/php/php-src/blob/af6c11c5f060870d052a2b765dc634d9e47d0f18/ext/date/lib/tm2unixtime.c
> >> > )
> >> >
> >> > The code in question (appears a lot):
> >> >
> >> > do {} while (do_range_limit(0, 60, 60, &rt->s, &rt->i));
> >> >
> >> > The method do_range_limit() will always return 0,
> >> > so why not
> >> > just call it like so:
> >> >
> >> > do_range_limit(0, 60, 60, &rt->s, &rt->i);
> >> >
> >> > And remove the do {} while loop.
> >>
> >> I can only tell you that removing them will cause 14 test cases to
> >> fail. Unfortunately I can't tell you why that happens.
>
> Never mind, I'm an idiot :)
>
> The following will work just peachy:
>
> https://github.com/datibbaw/php-src/compare/master...date-empty-loopsC0üˆý26o
> ãQ*Ï<
That looks fine. In earlier versions of the code, the do_range_limit
function did not in one go change the values and you had to call it in a
loop. The loop in general wouldn't be run more than once though.
cheers,
Derick
--
http://derickrethans.nl | http://xdebug.org
Like Xdebug? Consider a donation: http://xdebug.org/donate.php
twitter: @derickr and @xdebug
Posted with an email client that doesn't mangle email: alpine