Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:73061 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58292 invoked from network); 11 Mar 2014 10:45:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Mar 2014 10:45:07 -0000 Authentication-Results: pb1.pair.com header.from=derick@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=derick@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 82.113.146.227 as permitted sender) X-PHP-List-Original-Sender: derick@php.net X-Host-Fingerprint: 82.113.146.227 xdebug.org Linux 2.6 Received: from [82.113.146.227] ([82.113.146.227:45145] helo=xdebug.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 08/D3-29501-139EE135 for ; Tue, 11 Mar 2014 05:45:07 -0500 Received: from localhost (localhost [IPv6:::1]) by xdebug.org (Postfix) with ESMTPS id 0753110C18F; Tue, 11 Mar 2014 10:45:01 +0000 (GMT) Date: Tue, 11 Mar 2014 10:45:00 +0000 (GMT) X-X-Sender: derick@whisky.home.derickrethans.nl To: Tjerk Meesters cc: Kris Craig , Tig , PHP Internals In-Reply-To: Message-ID: References: User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [PHP-DEV] Possible tweak for tm2unixtime.c From: derick@php.net (Derick Rethans) On Tue, 11 Mar 2014, Tjerk Meesters wrote: > > On Tue, Mar 11, 2014 at 5:42 PM, Kris Craig wrote: > > > > On Tue, Mar 11, 2014 at 2:11 AM, Tjerk Meesters wrote: > > > >> On Tue, Mar 11, 2014 at 2:14 PM, Tig 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-loops 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