Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:26923 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 70755 invoked by uid 1010); 12 Dec 2006 19:33:07 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 70740 invoked from network); 12 Dec 2006 19:33:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Dec 2006 19:33:07 -0000 X-Host-Fingerprint: 83.160.219.156 korving.demon.nl Received: from [83.160.219.156] ([83.160.219.156:2422] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E4/C1-56358-0D30F754 for ; Tue, 12 Dec 2006 14:33:07 -0500 Message-ID: To: internals@lists.php.net Date: Tue, 12 Dec 2006 20:31:28 +0100 Lines: 33 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-Posted-By: 83.160.219.156 Subject: patch: remove unneeded strlen() check from php_addcslashes From: r.korving@xit.nl ("Ron Korving") 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++) {