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


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to