Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:47825 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35251 invoked from network); 7 Apr 2010 16:10:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Apr 2010 16:10:54 -0000 Authentication-Results: pb1.pair.com header.from=michael@no-surprises.co.uk; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=michael@no-surprises.co.uk; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain no-surprises.co.uk designates 80.68.93.37 as permitted sender) X-PHP-List-Original-Sender: michael@no-surprises.co.uk X-Host-Fingerprint: 80.68.93.37 river.mgdm.net Received: from [80.68.93.37] ([80.68.93.37:52044] helo=river.mgdm.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AE/48-20534-C8EACBB4 for ; Wed, 07 Apr 2010 12:10:52 -0400 Received: from [10.1.10.110] (emcukhs1.plus.com [84.92.198.99]) (Authenticated sender: michael) by river.mgdm.net (Postfix) with ESMTPSA id 5F1DEDF3F0; Wed, 7 Apr 2010 17:10:49 +0100 (BST) Message-ID: <4BBCAE8B.5010509@no-surprises.co.uk> Date: Wed, 07 Apr 2010 17:10:51 +0100 User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: Justin Dearing CC: internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Repetitive calling of Z_STRLEN_P(value) in ext/filter/logical_filter.c From: michael@no-surprises.co.uk (Michael Maclean) Justin Dearing wrote: > Hey, > > Sorry for pestering with excessive questions, but I've not done a lot of C > programming. > > In filter.c, specificalyl in php_filter_validate_ip(), Z_STRLEN_P(value) > gets called a lot. I know compilers tend to inline short functions, but are > they smart enough to assign a variable to a repetive macro expansion? Z_STRLEN_P is just a macro that expands to a variant of Z_STRLEN, which in turn is just (zval).value.str.len. These macros will be expanded by the preprocessor before the code is actually compiled. http://php-og.mgdm.net/opengrok/xref/PHP_5_3/Zend/zend_operators.h#Z_STRLEN_P Michael