Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:36426 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 21967 invoked from network); 24 Mar 2008 13:51:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Mar 2008 13:51:41 -0000 Authentication-Results: pb1.pair.com header.from=helly@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=helly@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 85.214.94.56 as permitted sender) X-PHP-List-Original-Sender: helly@php.net X-Host-Fingerprint: 85.214.94.56 aixcept.net Linux 2.6 Received: from [85.214.94.56] ([85.214.94.56:58561] helo=h1149922.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 89/73-04656-CE1B7E74 for ; Mon, 24 Mar 2008 08:51:40 -0500 Received: from MBOERGER-ZRH.corp.google.com (84-210.0-85.cust.bluewin.ch [85.0.210.84]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by h1149922.serverkompetenz.net (Postfix) with ESMTP id 5261E11F1A0; Mon, 24 Mar 2008 14:51:37 +0100 (CET) Date: Mon, 24 Mar 2008 14:51:06 +0100 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <1866997971.20080324145106@marcus-boerger.de> To: Gregory Beaver CC: Dmitry Stogov , internals Mailing List , Stanislav Malyshev In-Reply-To: <47E7B0ED.90902@chiaraquartet.net> References: <47E2F8FA.20107@chiaraquartet.net> <47E37C42.10308@zend.com> <47E3E7F1.3060200@chiaraquartet.net> <47E792E1.9070803@zend.com> <47E7AC60.1040705@chiaraquartet.net> <119518366.20080324143952@marcus-boerger.de> <47E7B0ED.90902@chiaraquartet.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] REMINDER - stream wrappers in include_path From: helly@php.net (Marcus Boerger) Hello Gregory, Monday, March 24, 2008, 2:47:25 PM, you wrote: > Marcus Boerger wrote: >> Hello Gregory, >> >> Monday, March 24, 2008, 2:28:00 PM, you wrote: >> >> >>> Index: main/fopen_wrappers.c >>> =================================================================== >>> RCS file: /repository/php-src/main/fopen_wrappers.c,v >>> retrieving revision 1.175.2.3.2.13.2.9 >>> diff -u -r1.175.2.3.2.13.2.9 fopen_wrappers.c >>> --- main/fopen_wrappers.c 24 Mar 2008 09:30:41 -0000 1.175.2.3.2.13.2.9 >>> +++ main/fopen_wrappers.c 24 Mar 2008 13:24:34 -0000 >>> @@ -473,7 +473,15 @@ >>> >>> ptr = path; >>> while (ptr && *ptr) { >>> - end = strchr(ptr, DEFAULT_DIR_SEPARATOR); >>> + /* Check for stream wrapper */ >>> + int is_stream_wrapper = 0; >>> + >>> + for (p = ptr; isalnum((int)*p) || *p == '+' || *p == '-' || *p == '.'; p++); >>> + if ((*p == ':') && (p - ptr > 1) && (p[1] == '/') && (p[2] == '/')) { >>> >> However how about: >> if ((p > ptr) && !memcmp(p, "://", 3)) { > this would unfortunately break UNC paths on unix, which start with //. > We have to verify that the stuff between : and : in the previous thing > is a valid stream wrapper, which means it can only be > alphanumeric/+/-/. However, I imagine the memcmp could be applied as if > ((*p == ':') && (p - ptr > 1) && !memcmp(p, "://", 3)) I must be missign something here. First p - ptr > 1 === p > ptr Second your do all && so I can reorder and get three consecutive char checks. Hence memcmp is the better option and clearer to read imo. > Would that really be faster? >> I think prefixinf with STREAMS_ would be good. > OK, updated and attached > Greg Best regards, Marcus