helly           Wed Jan 17 21:23:55 2007 UTC

  Modified files:              
    /php-src/ext/spl    spl_directory.c 
  Log:
  - A little help from Andrei
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.109&r2=1.110&diff_format=u
Index: php-src/ext/spl/spl_directory.c
diff -u php-src/ext/spl/spl_directory.c:1.109 
php-src/ext/spl/spl_directory.c:1.110
--- php-src/ext/spl/spl_directory.c:1.109       Tue Jan 16 23:52:14 2007
+++ php-src/ext/spl/spl_directory.c     Wed Jan 17 21:23:55 2007
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: spl_directory.c,v 1.109 2007/01/16 23:52:14 helly Exp $ */
+/* $Id: spl_directory.c,v 1.110 2007/01/17 21:23:55 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
@@ -77,10 +77,10 @@
        zend_object_std_dtor(&intern->std TSRMLS_CC);
        
        if (intern->path.v) {
-               efree(intern->path.s);
+               efree(intern->path.v);
        }
        if (intern->file_name.v) {
-               efree(intern->file_name.s);
+               efree(intern->file_name.v);
        }
        switch(intern->type) {
        case SPL_FS_INFO:
@@ -90,8 +90,8 @@
                        php_stream_close(intern->u.dir.dirp);
                        intern->u.dir.dirp = NULL;
                }
-               if (intern->u.dir.sub_path.s) {
-                       efree(intern->u.dir.sub_path.s);
+               if (intern->u.dir.sub_path.v) {
+                       efree(intern->u.dir.sub_path.v);
                }               
                break;
        case SPL_FS_FILE:
@@ -175,13 +175,7 @@
        }
 } /* }}} */
 
-#if defined(PHP_WIN32) || defined(NETWARE)
-# define is_slash(c) (c == '/' || c == '\\')
-#else
-# define is_slash(c) (c == '/')
-#endif
-
-#define is_slash_at(type, zs, pos) (type == IS_UNICODE ? is_slash(zs.u[pos]) : 
is_slash(zs.s[pos]))
+#define IS_SLASH_AT(type, zs, pos) (type == IS_UNICODE ? IS_U_SLASH(zs.u[pos]) 
: IS_SLASH(zs.s[pos]))
 
 /* {{{ spl_filesystem_dir_open */
 /* open a directory resource */
@@ -192,7 +186,7 @@
        intern->path_len = path_len;
        intern->u.dir.dirp = php_stream_u_opendir(type, path, path_len, 
REPORT_ERRORS, NULL);
 
-       if (intern->path_len && is_slash_at(type, path, intern->path_len-1)) {
+       if (intern->path_len && IS_SLASH_AT(type, path, intern->path_len-1)) {
                intern->path = ezstrndup(type, path, --intern->path_len);
        } else {
                intern->path = ezstrndup(type, path, intern->path_len);
@@ -229,7 +223,7 @@
                zend_list_addref(Z_RESVAL_P(intern->u.file.zcontext));
        }
 
-       if (intern->file_name_len && is_slash_at(intern->file_name_type, 
intern->file_name, intern->file_name_len-1)) {
+       if (intern->file_name_len && IS_SLASH_AT(intern->file_name_type, 
intern->file_name, intern->file_name_len-1)) {
                intern->file_name_len--;
        }
 

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

Reply via email to