helly Wed Mar 8 20:30:12 2006 UTC
Modified files:
/php-src/ext/spl spl_directory.c spl_directory.h
Log:
- Cloning might need special treatment as well
http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/spl_directory.c?r1=1.83&r2=1.84&diff_format=u
Index: php-src/ext/spl/spl_directory.c
diff -u php-src/ext/spl/spl_directory.c:1.83
php-src/ext/spl/spl_directory.c:1.84
--- php-src/ext/spl/spl_directory.c:1.83 Wed Mar 8 20:06:16 2006
+++ php-src/ext/spl/spl_directory.c Wed Mar 8 20:30:12 2006
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_directory.c,v 1.83 2006/03/08 20:06:16 helly Exp $ */
+/* $Id: spl_directory.c,v 1.84 2006/03/08 20:30:12 helly Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -70,8 +70,8 @@
{
spl_filesystem_object *intern = (spl_filesystem_object*)object;
- if (intern->oth_dtor) {
- intern->oth_dtor(intern TSRMLS_CC);
+ 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);
@@ -133,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;
@@ -273,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;
}
/* }}} */
http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/spl_directory.h?r1=1.21&r2=1.22&diff_format=u
Index: php-src/ext/spl/spl_directory.h
diff -u php-src/ext/spl/spl_directory.h:1.21
php-src/ext/spl/spl_directory.h:1.22
--- php-src/ext/spl/spl_directory.h:1.21 Wed Mar 8 20:06:16 2006
+++ php-src/ext/spl/spl_directory.h Wed Mar 8 20:30:12 2006
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_directory.h,v 1.21 2006/03/08 20:06:16 helly Exp $ */
+/* $Id: spl_directory.h,v 1.22 2006/03/08 20:30:12 helly Exp $ */
#ifndef SPL_DIRECTORY_H
#define SPL_DIRECTORY_H
@@ -33,7 +33,7 @@
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;
@@ -41,11 +41,17 @@
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_foreign_dtor_t oth_dtor;
+ spl_other_handler *oth_handler;
char *path;
int path_len;
char *file_name;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php