cvs: php-src(PHP_5_1) /ext/spl spl_directory.c spl_directory.h

From: Date: Wed, 08 Mar 2006 21:54:48 +0000
Subject: cvs: php-src(PHP_5_1) /ext/spl spl_directory.c spl_directory.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-37193@lists.php.net to get a copy of this message
helly Wed Mar 8 21:54:48 2006 UTC Modified files: (Branch: PHP_5_1) /php-src/ext/spl spl_directory.c spl_directory.h Log: - MFH Allow pecl/phar and alike too hook into spl_filesystem_object's http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/spl_directory.c?r1=1.45.2.23&r2=1.45.2.24&diff_format=u Index: php-src/ext/spl/spl_directory.c diff -u php-src/ext/spl/spl_directory.c:1.45.2.23 php-src/ext/spl/spl_directory.c:1.45.2.24 --- php-src/ext/spl/spl_directory.c:1.45.2.23 Mon Mar 6 09:50:44 2006 +++ php-src/ext/spl/spl_directory.c Wed Mar 8 21:54:48 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_directory.c,v 1.45.2.23 2006/03/06 09:50:44 helly Exp $ */ +/* $Id: spl_directory.c,v 1.45.2.24 2006/03/08 21:54:48 helly Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -70,6 +70,9 @@ { spl_filesystem_object *intern = (spl_filesystem_object*)object; + if (intern->oth_handler && intern->oth_handler->dtor) { + intern->oth_handler->dtor(intern TSRMLS_CC); + } zend_hash_destroy(intern->std.properties); FREE_HASHTABLE(intern->std.properties); @@ -130,7 +133,7 @@ intern = emalloc(sizeof(spl_filesystem_object)); memset(intern, 0, sizeof(spl_filesystem_object)); intern->std.ce = class_type; - /* intern->type = SPL_FS_INFO; done by set o */ + /* intern->type = SPL_FS_INFO; done by set 0 */ intern->file_class = spl_ce_SplFileObject; intern->info_class = spl_ce_SplFileInfo; if (obj) *obj = intern; @@ -270,9 +273,14 @@ intern->info_class = source->info_class; intern->flags = source->flags; intern->oth = source->oth; + intern->oth_handler = source->oth_handler; zend_objects_clone_members(new_object, new_obj_val, old_object, handle TSRMLS_CC); + if (intern->oth_handler && intern->oth_handler->clone) { + intern->oth_handler->clone(source, intern TSRMLS_CC); + } + return new_obj_val; } /* }}} */ @@ -437,8 +445,8 @@ if (!len) { php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); - zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Directory name must not be empty."); - return; + zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Directory name must not be empty."); + return; } intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/spl_directory.h?r1=1.12.2.4&r2=1.12.2.5&diff_format=u Index: php-src/ext/spl/spl_directory.h diff -u php-src/ext/spl/spl_directory.h:1.12.2.4 php-src/ext/spl/spl_directory.h:1.12.2.5 --- php-src/ext/spl/spl_directory.h:1.12.2.4 Tue Feb 28 01:33:32 2006 +++ php-src/ext/spl/spl_directory.h Wed Mar 8 21:54:48 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_directory.h,v 1.12.2.4 2006/02/28 01:33:32 helly Exp $ */ +/* $Id: spl_directory.h,v 1.12.2.5 2006/03/08 21:54:48 helly Exp $ */ #ifndef SPL_DIRECTORY_H #define SPL_DIRECTORY_H @@ -33,14 +33,25 @@ PHP_MINIT_FUNCTION(spl_directory); typedef enum { - SPL_FS_INFO, + SPL_FS_INFO, /* must be 0 */ SPL_FS_DIR, SPL_FS_FILE, } SPL_FS_OBJ_TYPE; -typedef struct _spl_filesystem_object { +typedef struct _spl_filesystem_object spl_filesystem_object; + +typedef void (*spl_foreign_dtor_t)(spl_filesystem_object *object TSRMLS_DC); +typedef void (*spl_foreign_clone_t)(spl_filesystem_object *src, spl_filesystem_object *dst TSRMLS_DC); + +typedef struct _spl_other_handler { + spl_foreign_dtor_t dtor; + spl_foreign_clone_t clone; +} spl_other_handler; + +struct _spl_filesystem_object { zend_object std; void *oth; + spl_other_handler *oth_handler; char *path; int path_len; char *file_name; @@ -73,7 +84,7 @@ zend_function *func_getCurr; } file; } u; -} spl_filesystem_object; +}; #define SPL_FILE_OBJECT_DROP_NEW_LINE 0x00000001 /* drop new lines */

« previous php.cvs (#37193) next »