dmitry          Fri Nov 10 10:55:27 2006 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src    NEWS 
    /php-src/main       fopen_wrappers.c 
    /php-src/main/streams       plain_wrapper.c 
  Log:
  Removed unnecessary checks for ISREG file and corresponding stat() calls on 
Windows
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.345&r2=1.2027.2.547.2.346&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.345 php-src/NEWS:1.2027.2.547.2.346
--- php-src/NEWS:1.2027.2.547.2.345     Fri Nov 10 10:47:52 2006
+++ php-src/NEWS        Fri Nov 10 10:55:26 2006
@@ -1,6 +1,8 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 2007, PHP 5.2.1
+- Windows related optimizations (Dmitry, Stas)
+  . removed unnecessary checks for ISREG file and corresponding stat() calls
 - Zend Memory Manager Improvements (Dmitry)
   . use HeapAlloc() instead of VirtualAlloc()
   . use "win32" storage manager (instead of "malloc") on Windows by default
http://cvs.php.net/viewvc.cgi/php-src/main/fopen_wrappers.c?r1=1.175.2.3.2.2&r2=1.175.2.3.2.3&diff_format=u
Index: php-src/main/fopen_wrappers.c
diff -u php-src/main/fopen_wrappers.c:1.175.2.3.2.2 
php-src/main/fopen_wrappers.c:1.175.2.3.2.3
--- php-src/main/fopen_wrappers.c:1.175.2.3.2.2 Fri Nov 10 09:56:16 2006
+++ php-src/main/fopen_wrappers.c       Fri Nov 10 10:55:26 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: fopen_wrappers.c,v 1.175.2.3.2.2 2006/11/10 09:56:16 dmitry Exp $ */
+/* $Id: fopen_wrappers.c,v 1.175.2.3.2.3 2006/11/10 10:55:26 dmitry Exp $ */
 
 /* {{{ includes
  */
@@ -255,7 +255,9 @@
 PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle TSRMLS_DC)
 {
        FILE *fp;
+#ifndef PHP_WIN32
        struct stat st;
+#endif
        char *path_info, *filename;
        int length;
 
@@ -321,11 +323,14 @@
        }
        fp = VCWD_FOPEN(filename, "rb");
 
+#ifndef PHP_WIN32
        /* refuse to open anything that is not a regular file */
        if (fp && (0 > fstat(fileno(fp), &st) || !S_ISREG(st.st_mode))) {
                fclose(fp);
                fp = NULL;
        }
+#endif
+
        if (!fp) {
                STR_FREE(SG(request_info).path_translated);     /* for same 
reason as above */
                SG(request_info).path_translated = NULL;
http://cvs.php.net/viewvc.cgi/php-src/main/streams/plain_wrapper.c?r1=1.52.2.6.2.8&r2=1.52.2.6.2.9&diff_format=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.52.2.6.2.8 
php-src/main/streams/plain_wrapper.c:1.52.2.6.2.9
--- php-src/main/streams/plain_wrapper.c:1.52.2.6.2.8   Thu Oct 19 09:49:44 2006
+++ php-src/main/streams/plain_wrapper.c        Fri Nov 10 10:55:26 2006
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: plain_wrapper.c,v 1.52.2.6.2.8 2006/10/19 09:49:44 dmitry Exp $ */
+/* $Id: plain_wrapper.c,v 1.52.2.6.2.9 2006/11/10 10:55:26 dmitry Exp $ */
 
 #include "php.h"
 #include "php_globals.h"
@@ -891,6 +891,8 @@
                                efree(persistent_id);
                        }
 
+                       /* WIN32 always set ISREG flag */
+#ifndef PHP_WIN32
                        /* sanity checks for include/require.
                         * We check these after opening the stream, so that we 
save
                         * on fstat() syscalls */
@@ -899,15 +901,12 @@
                                int r;
 
                                r = do_fstat(self, 0);
-                               if (
-#ifndef PHP_WIN32
-                                               (r != 0) || /* it is OK for 
fstat to fail under win32 */
-#endif
-                                               (r == 0 && 
!S_ISREG(self->sb.st_mode))) {
+                               if ((r == 0 && !S_ISREG(self->sb.st_mode))) {
                                        php_stream_close(ret);
                                        return NULL;
                                }
                        }
+#endif
 
                        return ret;
                }

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to