Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:26932 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49750 invoked by uid 1010); 13 Dec 2006 15:37:19 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 49734 invoked from network); 13 Dec 2006 15:37:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Dec 2006 15:37:19 -0000 Authentication-Results: pb1.pair.com header.from=iliaal@gmail.com; sender-id=pass; domainkeys=good Authentication-Results: pb1.pair.com smtp.mail=iliaal@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 64.233.162.229 as permitted sender) DomainKey-Status: good X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: iliaal@gmail.com X-Host-Fingerprint: 64.233.162.229 nz-out-0506.google.com Linux 2.4/2.6 Received: from [64.233.162.229] ([64.233.162.229:27223] helo=nz-out-0506.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F4/B1-38081-B0E10854 for ; Wed, 13 Dec 2006 10:37:19 -0500 Received: by nz-out-0506.google.com with SMTP id k1so115195nzf for ; Wed, 13 Dec 2006 07:36:41 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:in-reply-to:references:mime-version:x-priority:content-type:message-id:cc:content-transfer-encoding:from:subject:date:to:x-mailer:sender; b=nwK2GIeJcAQg+JQrT6PNckXv4B9FfC+Dp1vZ8KTqh/kr4sNmGJvpF2SiQcszEGXBvnH+JiS8CJBkmHePOZ87hT/ARlS2BHV3i96dSnI7cg5p608ar0+V95axw2xHivtyLdOX8R2Lk0aFSTQpG22KuPhV1Uj+tRRGnPu/dr/mTl8= Received: by 10.65.222.11 with SMTP id z11mr5122984qbq.1166024200919; Wed, 13 Dec 2006 07:36:40 -0800 (PST) Received: from ?192.168.1.6? ( [74.108.69.82]) by mx.google.com with ESMTP id c6sm1041972qbc.2006.12.13.07.36.39; Wed, 13 Dec 2006 07:36:40 -0800 (PST) In-Reply-To: References: Mime-Version: 1.0 (Apple Message framework v752.3) X-Priority: 3 Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-ID: <018E0E47-1144-45B0-8933-5F77513FFB51@prohost.org> Cc: internals@lists.php.net Content-Transfer-Encoding: 7bit Date: Wed, 13 Dec 2006 10:36:36 -0500 To: Ron Korving X-Mailer: Apple Mail (2.752.3) Sender: Ilia Alshanetsky Subject: Re: [PHP-DEV] patch: remove unneeded strlen() check from php_addcslashes From: ilia@prohost.org (Ilia Alshanetsky) This code is a fallback in instances where length is not know, which is something that may happen. Given that this is an API function I don't think we can make this change as it may break out-of-php code that relies on this functionality. I really don't think you'll see any visible gain by eliminating a if (!length) {} check. On 12-Dec-06, at 2:31 PM, Ron Korving wrote: > Hi, > > The strlen() check on line 4730 of ext/standard/string.c is pointless > because of the length assignment in line 4720. Below is a patch > (against > latest 5.2) to remove them. > > Regards, > > Ron Korving > > > > Index: ext/standard/string.c > =================================================================== > RCS file: /repository/php-src/ext/standard/string.c,v > retrieving revision 1.621 > diff -u -r1.621 string.c > --- ext/standard/string.c 12 Dec 2006 18:17:56 -0000 1.621 > +++ ext/standard/string.c 12 Dec 2006 19:26:40 -0000 > @@ -4727,10 +4727,6 @@ > wlength = strlen(what); > } > > - if (!length) { > - length = strlen(str); > - } > - > php_charmask((unsigned char*)what, wlength, flags TSRMLS_CC); > > for (source = str, end = source + length, target = new_str; (c = > *source) > || (source < end); source++) { > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > Ilia Alshanetsky